Skip to main content

Microsoft Silverlight

Unanswered Question Hosting Silverlight in IIS5.1RSS Feed

(0)

tehprata
tehprata

Member

Member

0 points

12 Posts

Hosting Silverlight in IIS5.1

Hi,

How can I host my Silverlight application in IIS 5.1? I'm able to host my ASP.NET website properly but am now trying to host my Silverlight project (and its website) on IIS too. I created a virtual directory by right-clicking my ASP.NET website node in IIS and then pointing it to the SLApp.Web folder that's now located in C:\Inetpub\wwwroot\ArtViewerSL.

I have also configured my MIME types to the following:

1) .xaml & application/xaml+xml

2)  .xap & application/x-silverlight-app

When I tried browsing the Silverlight ASPX page, I'm unable to view.. I think it is reading from the wrong web.config (my main asp.net website web.config) file.

I think I am doing it wrong in hosting the Silverlight 2 application.. Can I get some help please?

Regards

Prata

Pravinkumar R. D.
Pravinku...

Contributor

Contributor

4300 points

708 Posts

Re: Hosting Silverlight in IIS5.1

Hi,

I am not sure this will help you. But, Goto IIS site. Right click to the site Goto Properties. Then check ASP.NET Tab. and check if the ASP.NET version is selected correctly.

Thanks,

Pravin

"Please mark as answered, if this answers your question"

max_pau
max_pau

Member

Member

218 points

66 Posts

Re: Hosting Silverlight in IIS5.1

 I'm hosting my silverlight 3 application on iis 5.1 well

What browsers do you use?

Are other silverlight applications working well?

Can you migrate to Silverlight 3 or Silverlight 2 is a strict requirement?

tehprata:
I think it is reading from the wrong web.config (my main asp.net website web.config) file.

Why do you think so?

 

Do not forget to click "Mark as Answer" on my post that helped you

tehprata
tehprata

Member

Member

0 points

12 Posts

Re: Hosting Silverlight in IIS5.1

I tested my application again on my home IIS server. I was able to display the Silverlight application out but it doesn't seem to download the XML file I already configured in Page.xaml.cs.

Here is what I've done:
- Changed my XML url (http://localhost/ArtViewerSL.Web/catalogdata.xml)
- Went to http://localhost/SLvideos/ArtViewerSLTestPage.aspx in Firefox
- Application loads, but does not seem to download the XML content
- Tested to see the GET requests with HttpFox and results showed that it was looking for a clientaccesspolicy.xml and crossdomain.xml.

I'm not sure completely but my guess is it's because of this. So I did some googling, created the clientaccesspolicy.xml and placed it at the root folder of my server - that is: C:\inetpub\wwwroot. Restarted my IIS, browsed again in Firefox and still unable to show any XML content.

clientaccesspolicy.xml

<access-policy>
    <cross-domain-access>
        <policy>
            <allow-from http-request-headers="*">
                <domain uri="*" />                
            </allow-from>
            <grant-to>
                <resource include-subpaths="true" path="/" />
            </grant-to>
        </policy>
    </cross-domain-access>
</access-policy>
 

I think the problem is because it's looking at the wrong place. I tested again in HttpFox, and it showed Port number 8081. My server runs on 80. Did a search in my Silverlight Project and Silverlight Website, and found that the .csproj (belonging to the Silverlight Website) had '8081' in it. Changed to 80, but still did not work. How can I change the application such that it looks for clientaccesspolicy at localhost:80 and not 8081?

<ProjectExtensions>
    <VisualStudio>
      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
        <WebProjectProperties>
          <UseIIS>False</UseIIS>
          <AutoAssignPort>False</AutoAssignPort>
          <DevelopmentServerPort>80</DevelopmentServerPort>
          <DevelopmentServerVPath>/</DevelopmentServerVPath>
          <IISUrl>
          </IISUrl>
          <NTLMAuthentication>False</NTLMAuthentication>
          <UseCustomServer>False</UseCustomServer>
          <CustomServerUrl>
          </CustomServerUrl>
          <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
        </WebProjectProperties>
      </FlavorProperties>
    </VisualStudio>
  </ProjectExtensions>
 

I'm still not sure if this will solve the problem of hosting on IIS, but it's what I've found so far. Hope to hear a reply soon.

tehprata
tehprata

Member

Member

0 points

12 Posts

Re: Hosting Silverlight in IIS5.1

Weird.. I changed my server port to 8081 hoping that it will find the clientaccessfile. And it did, but now it wouldn't find my XML file. HttpFox reports that the application is looking for the XML file at inetpub/wwwroot folder instead of the web application folder. Making a copy of that XML file and then putting it in the inetpub/wwwroot folder seem to make the application work but I don't want to put the XML file at the root. Is there anyway I can resolve this?

msalsbery
msalsbery

Contributor

Contributor

2066 points

379 Posts

Re: Hosting Silverlight in IIS5.1

tehprata:
I don't want to put the XML file at the root
 

 

It has to be located at the root of the domain you are setting the policy for.

 

Mark Salsbery
Microsoft MVP - Visual C++

tehprata
tehprata

Member

Member

0 points

12 Posts

Re: Hosting Silverlight in IIS5.1

Then that would mean I need to use port 8081 for my main website and the Silverlight application. I want to keep it to port 80 for my main website. Is this not possible at all? How about the clientaccesspolicy.xml? Can I make it such that it's looking at port 80 instead of 8081?

msalsbery
msalsbery

Contributor

Contributor

2066 points

379 Posts

Re: Hosting Silverlight in IIS5.1

tehprata:
Can I make it such that it's looking at port 80 instead of 8081?


I'm going to back up here - I thought it was the clientaccesspolicy.xml file that wasn't getting downloaded.

Rereading your previous post more closely...

You show two URLs 

1) One for the Site/page hosting the silverlight app: http://localhost/SLvideos/ArtViewerSLTestPage.aspx

2) And the URL for the XML file you are trying to retrieve:   http://localhost/ArtViewerSL.Web/catalogdata.xml

There's nothing about either of those that specifies any port, so port 80 will be used.

I am curious why one is localhost/SLvideos and the other is localhost/ArtViewerSL.Web, however.  What is ArtViewerSL.Web? A virtual directory?  Another site?   If this is a clientaccesspolicy issue, then whatever the root folder localhost/ArtViewerSL.Web maps to needs to have the clientaccesspolicy.xml file in it.

 

 

Mark Salsbery
Microsoft MVP - Visual C++

tehprata
tehprata

Member

Member

0 points

12 Posts

Re: Hosting Silverlight in IIS5.1

 My apologies - I should have been clearer.

The clientaccesspolicy.xml, as I've read from articles online, must be in the C:\Inetpub\wwwroot. And I've not moved it anywhere else. The Silverlight application is trying to download videos.xml which is originally located in the ArtViewerSL.Web folder. However, when I ran the application, HttpFox reported that it was looking for the clientaccesspolicy on port 8081 when it should have been on port 80. So I decided to change my IIS port to 8081 and now that it has found the clientaccesspolicy.xml file, it is now looking for the videos.xml file at C:\inetpub\wwwroot instead of C:\inetpub\wwwroot\ArtViewerSL.Web folder.

Now I want to host my server on port 80 and not 8081. But if I change back to 80, it will not find the clientaccesspolicy.xml because the application is looking at port 8081. So how can I change it such that the application is looking for clientaccesspolicy.xml on port 80 instead of 8081?

msalsbery
msalsbery

Contributor

Contributor

2066 points

379 Posts

Re: Hosting Silverlight in IIS5.1

tehprata:
My apologies - I should have been clearer.
 


I apologize - I should have read more clearer :)

 

tehprata:
The clientaccesspolicy.xml, as I've read from articles online, must be in the C:\Inetpub\wwwroot.
 


Not necessarily.  It needs to be at the root of any domain that  you request resources from outside the domain the Silverlight application making the request is hosted on.

 

I'm still confused on this part - If ArtViewerSL.Web is just a folder, there shouldn't be a cross domain issue since everything is on the same domain (localhost, according to your URLs).

Also, port 8081 shouldn't be used by anything you've described....are you sure  ArtViewerSL.Web doesn't map to another web application or web service configured to port 8081?  Is there a web.config file involved here?

 

Mark Salsbery
Microsoft MVP - Visual C++
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities