11

I created a small Silverlight 4.0 / RIA Services application and tested it. I developed the app on a machine at home and needed to move it to the production domain at work. I did this by pushng it to the source repository and then cloning it to a dev machine at work. It builds without an error in both locations.

The problem occurs when I attempt to debug in the new location. At the first 'Load()' method on the domain context I get the following error:

The provided URI scheme 'file' is invalid expected 'http'

I get that the debugger is attempting to run with file based URI rather than an HTTP URI. But, why? And how do I fix it?

Searching through SO returned some similar errors regarding invalid URI schemes, but non of them helped me with this specific issue.

Thanks, Jim

Jim Reineri
  • 2,830
  • 3
  • 31
  • 32

4 Answers4

29

Make sure your startup project is the web project, and not the Silverlight project itself.

Martin Doms
  • 8,598
  • 11
  • 43
  • 60
  • 4
    Or, if debuggin out of browser, then set the Silverlight project as the startup, but in the settings for the silverlight project, under "Debug", set the server project as the Out-of-browser application rather than the silverlight project. Not totally intuitive, but you have to do this to get rid of the "file://" issue. – JoeCool Sep 02 '11 at 15:01
  • 1
    thanks that helped. I just want to add a bit in case someone gets it. my error started to happened when i deleted my suo file, I guess the reference to the start project is in this file. – ramnz Mar 09 '12 at 17:47
1

What is probably happening is that the Silverlight client application is trying to communicate with the server-side RIA Services web service using a "file://" protocol.
Have you launched the Silverlight XAP file directly from the file system of the server instead of through a 'http://" URL? Silverlight is trying to use the same protocol as the one used to get its XAP file.
For the same reason, when launching the application from Visual Studio, set the Web project as the startup project instead of the Silverlight (client) project.

ZunTzu
  • 406
  • 5
  • 6
1

If you are running OOB (Out Of Browser) and want to debug, then you need to set your Silverlight client project as the start up project, also within the server project, right click on your '*TestPage.html' and 'Set as Start Page'. Then, if you get the error...

The provided URI scheme 'file' is invalid expected 'http'

Then open the properties page of the Silverlight client and UNCHECK "Enable running application out of the browser", click Save and then CHECK the setting back on and it should work. see... http://blogs.msdn.com/b/deepm/archive/2010/07/16/debugging-an-oob-silverlight-business-application.aspx

tkerwood
  • 1,875
  • 16
  • 26
  • Like I posted above in my comment for ZunTzu, you also have to go to the settings for the silverlight project, and under "Debug" set the server project as the Out-of-browser application rather than the silverlight project. – JoeCool Sep 02 '11 at 15:03
0

I am pretty sure you are supposed to reference a server side file, not a local file. Additionally most Silverlight applications are not allowed to access local files.

Alex Lo
  • 1,299
  • 8
  • 10
  • The program is not written to acess local files. The error occurs when the Silverlight module is making the RIA service method call. This did work on the original development environment and only failed after moving to another identical (as far as I can tell, but obviously not quite) environment. – Jim Reineri Oct 13 '10 at 02:00