Debugging Silverlight via IIS

This one has me scratching my head. I noticed tonight as I was investigating how to get QueryString parameters to my XAML code-behind file that the default Silverlight Project configuration opens your .html page via the filesystem, NOT as a website (virtual or otherwise). When I F5 into my very simple Silverlight test project, the browser opens:

C:\Users\Anthony.bear2\Documents\Visual Studio 2008\Projects\SilverlightProject1\SilverlightProject1\TestPage.html

When I had expected it to prompt me to set up a website or virtual root and go to something like:

http://localhost:1234/SilverlightProject1/TestPage.html

Stumper. I don’t see any options in the project properties to configure a web app either. Mike Taulty seems to have concluded that you need to create a new Web Site project and link to Silverlight, with some additional copying. Seems error-prone to me. However, this official-looking post from MSFT seems to confirm that this method is indeed state-of-the-art with regard to debugging Silverlight apps via IIS.

To summarize from the above post:

  • Add a website to the solution.
  • Right click on a folder in the website and use the “Add Silverlight link” command to link the output from the Silverlight project to the website. Click Yes to enabling Silverlight debugging from the website.
  • Copy the testpage.htm, js, and silverlight.js to the website or use the asp:xaml control in an aspx page.
  • You should now be able to set the website as the startup project.
  • F5 Should now launch the page in the website in the browser under the debugger and using the web server for the web project.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s





%d bloggers like this: