System.ArgumentException: The provided URI scheme 'file' is invalid; expected 'http'.
The error occurred when debugging a Silverlight app that uses Windows Communication Foundation (WCF). When running the debugger, the IDE was launching the html file hosting the Silverlight application, but it was launching it in the browser using a file path, F:\Projects\MyLOBApp\Bin\Debug\TestPage.html, not through IIS as http://localhost/MyLOBApp/TestPage.html. The application was using the following code in a global application class to set the URL to the WCF service.
My solution consists of two projects:
- The Silverlight application project
- The WCF service project
Upon closer inspection of the file path, Visual Studio was launching the test page from the Silverlight project when it should have been launching the test html page from the WCF project. The simple solution was to set the WCF project as the StartUp Project. That should have been more obvious especially in light of the following message box that popped up before the debugger started, but it was initially overlooked because of the similar project names and html page filenames in the two projects.