views:

214

answers:

2
  1. I have created an silverlight application (i have not selected my application to be hosted from another web application).

  2. Now I created a simple hello world page.

  3. I created virtual directory of my silverlight project in IIS for application hosting.

4. When I browse MainPage.xaml in loaclhost, it is not running.

>>I think I shoul run the .xap file to host my application but I dont know haw??? OR Is it necessary to host a silverlight application from a .aspx page??

+2  A: 

You should have a Default.aspx page which hosts the Silverlight application. Set this to your Default page to see if that works.

Ardman
when I create new silverlight project it asks **Host the Silverlight application in a new Website** followed by two fields-1. Name: projectName.web2. Type: ASP.Net Web Application Project OR Asp.Net Web Sitewhen I uncheck this checkbox VS doen not create projectName.web project but when I **check** this VS creates two projects1. projectName-->contains .xaml pages2. projectName.web--> contains default.aspx pageSo my question is - **Is it must to host silverlight app from a new website(default.aspx page) OR cant we directly host .xaml page? ProjectName.Web project is req.??**
nectar
Check here:http://learn.iis.net/page.aspx/262/configuring-iis-for-silverlight-applications/
Ardman
there is no config settings for IIS in windows XP.
nectar
I think that you only need to add a .xap mime type.
Ardman
Creating a mime map entry is a good idea but for a default IIS 5.1 setup not necessary, it comes with a .* to application/octet-stream mapping which Silverlight is quite happy with.
AnthonyWJones
A: 

If you haven't created a web host project along with your silverlight application then when you debug the Silverlight application it creates a TestPage.html file in the bin\debug directory under you project directory.

This page hosts the XAP and is what the IDE specifies as the page to open by the browser instance it creates when you start debugging.

Hence to host this in your IIS 5.1 server you can create a virtual directory pointing at the bin\debug folder in your project. Navigating to TestPage.html in that virtual directory (for example http://localhost/myvirtualdir/testpage.html) will load your application.

AnthonyWJones
Its working....Anthony you are too great.
nectar