views:

792

answers:

2

Hello all,

I am trying to build a small silverlight application. I've got files I am hosting on my localhost. I want to be able to use MediaElement to play them. However I keep getting this annoying error message when I launch my silverlight application:

Error: Unhandled Error in Silverlight 2 Application SLControls.xap Code: 4001
Category: MediaError
Message: AG_E_NETWORK_ERROR

I am using the following line to init the MediaElement source:

Uri.TryCreate(http://localhost:/mywebsite/Data/Users/16/Channels/472.MP3, UriKind.Absolute, out Channellocation);

Thank you in advance,

Vondiplo

+1  A: 

May be the problem is in ':' character after localhost? Try this link: http://localhost/mywebsite/Data/Users/16/Channels/472.MP3

You can debug network problems using Fiddler tool.

Alexander K.
A: 

Silverlight does not support cross-scheme newtwork requests. If you creates your application from Blend 2 SP1, or choose not to generate a test ASP.NET site, by default the IDE will generate a Test page automatically and run it using the file:// scheme. Make sure that you are not using the file:// scheme, and for sure make sure that if you pasted the URL in your browser, the file is successfully located.

Yasser Makram