问题
I get the following error after moving aspx page to some folder.
Error: Unhandled Error in Silverlight Application
Code: 2104
Category: InitializeError
Message: Could not download the Silverlight application. Check web server settings
Environment: Win7 x64, VS2010, SL 4.0.50524.0, IE8, IIS7.5
Steps to reproduce:
In VS 2010 create a new Silverlight Application (target .NET Framework 4.0).
Host the Silverlight application (Silverlight version 4.0) in a new Web site (Web application project).
- Runs SilverlightApplication.web project, where the starting page is SilverlightApplicationTestPage.aspx
- Application run successful without any error.
In VS2010, create a new folder with name Test under SilverlightApplication.web project and move the SilverlightApplicationTestPage.aspx page to it.
SilverlightApplication.web -- Test -- SilverlightApplicationTestPage.aspx
- In the SilverlightApplication.web project change the path to the starting page refer to the moved pageSilverlightApplicationTestPage.aspx (Properties -> Web tab -> Start Action -> Specific Page = Test/SilverlightApplication5TestPage.aspx)
- Runs SilverlightApplication.web project again.
Result: The above JS error appears.
I have checked the MIME types (xaml, xap and etc.) in my IIS. They are present. I can successfully access directly to the SilverlightApplication.xap file.
Do you have any idea what I'm doing wrong?
Maybe I should change some additional settings after moving asp page that host Silverlight control?
回答1:
I got the same result when following your instructions. The problem is the following line in your aspx page:
<param name="source" value="ClientBin/TestOnly.xap"/>
The page is trying to load the XAP file from a directory called ClientBin under your test directory. Change the line to this:
<param name="source" value="/ClientBin/TestOnly.xap"/>
Now the path will start at the root of the web site. I also noticed this line in the aspx page:
<script type="text/javascript" src="Silverlight.js"></script>
This won't load correctly either for the same reason. I changed the line to:
<script type="text/javascript" src="/Silverlight.js"></script>
来源:https://stackoverflow.com/questions/3133168/code-error-2104-after-moving-aspx-page-to-some-folder