Thursday, August 30, 2012

Silverlight, SignalR and IIS Applications off of the Default Web Site

Silverlight, SignalR and IIS Applications off of the Default Web Site

I'm using SignalR in a Silverlight 5 application. When I host my app in an "application" off of the default website in IIS 7.5 (i.e. localhost/subsite) Fiddler shows I get a 404 for "/signalr/negotiate".

It doesn't seem to take the IIS application path into account. It should be requesting "/subsite/signalr/negotiate". How do I get it to use the correct url prefix?

Update: I had to use the following code because it seems to be difficult to get the real root URI in a silverlight app without doing some parsing.

string xapLocationUri = Application.Current.Host.Source.AbsoluteUri;    string rootUri = xapLocationUri.Substring(0, xapLocationUri.IndexOf("/ClientBin"));    hubConnection = new HubConnection(rootUri);   

You can't really rely on the following if you're hosted in an application off of the root web site in IIS:

Application.Current.Host.Source.GetComponents(UriComponents.Scheme | UriComponents.HostAndPort, UriFormat.Unescaped)   

Answers & Comments...




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog