Code error 2104 after moving aspx page to some folder

怎甘沉沦 提交于 2019-12-09 20:00:31

问题


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:

  1. In VS 2010 create a new Silverlight Application (target .NET Framework 4.0).

  2. Host the Silverlight application (Silverlight version 4.0) in a new Web site (Web application project).

  3. Runs SilverlightApplication.web project, where the starting page is SilverlightApplicationTestPage.aspx
  4. Application run successful without any error.
  5. 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

  6. 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)
  7. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!