Select to view content in your preferred language

Invalid URI sheme 'file://' for map control

2439
2
08-22-2011 02:12 PM
ShaningYu
Honored Contributor
I created several of project templates by using some open-source sample templates.  When I run the debugging, some of them work well, and some of them don't.  E.g., no map displays in some cases with the error message: 'Invalid URI sheme 'file://' for map control.\nControl must be hosted in a HTTP(s) websites'.  What's the possible solution for this issue?  Please share your experience.  Thanks.
0 Kudos
2 Replies
RahulMetangale
Emerging Contributor
In general in normal silverlight application there are two projects: One is the Silverlight project, and the other is the website that you will be hosting your silverlight project in. The website must be the startup project. If your Silverlight project is the startup project, the page is run from a file://... URL, instead of http://...
Since the map control is talking to REST services hosted on HTTP(S), the silverlight application MUST run under a http:// url. Running as file:// is considered "cross scheme" and is blocked by Silverlight for security reasons.

Normally when you create a new Silverlight project, you will be asked if you want to create a website to host it in. Always answer yes to this, and it should be set up automatically.
0 Kudos
ShaningYu
Honored Contributor
Problem solved - Go to
http://stackoverflow.com/questions/6125293/silverlight-4-out-of-browser-unable-to-determine-the-url-...
In the myproject.csproj.user file, change
<OutOfBrowserProjectToDebug>OldName</OutOfBrowserProjectToDebug>
to
<OutOfBrowserProjectToDebug>NewName</OutOfBrowserProjectToDebug>
0 Kudos