问题
I have a really odd 2104 error occurring when I am hosting a Silverlight control in my MVC site.
If I go to http://mywebsite.com/SomeController then the Silverlight application will load correctly. However, if I go to http://mywebsite.com/SomeController/Index then it fails to load and I get the 2104 error. I tried to change the Action name to something other than index, but still no luck.
Right now, it's just boilerplate Silverlight control code, but I need to add some initParams to it, so I need my action to look like http://mywebsite.com/SomeController/Index/1/2
Does anyone have any ideas on what could be causing this?
回答1:
Code 2104 is "Could not download the Silverlight application. Check web server settings". List of codes are here.
You are likely using a relative URL for your silverlight object, which doesn't resolve correctly if you are in a subdirectory.
Use the tilde syntax to correctly point to your silverlight object:
<param name="source" value="<% = Url.Content("~/ClientBin/MySilverlightThing.xap") %>"/>
来源:https://stackoverflow.com/questions/4336419/silverlight-2104-error-w-mvc-project-as-host