My Silverlight 4 app is hosted in ASP.NET MVC 2 web application. It works fine when I browse with Internet Explorer 8. However Google Chrome (version 5) cannot find ASP.NET controllers. Specifically, the following ASP.NET controller works both with Chrome and IE.
//[OutputCache(NoStore = true, Duration = 0, VaryByParam = "None")]
public ContentResult TestMe()
{
ContentResult result = new ContentResult();
XElement response = new XElement("SvrResponse",
new XElement("Data", "my data"));
result.Content = response.ToString();
return result;
}
If I uncomment [OutputCache] attribute then it works with IE but not with Chrome. Also, I use custom model binding with controllers, so if I write the following:
public ContentResult TestMe(UserContext userContext)
{
...
}
it also works with IE, but again not with Chrome which gives me error message saying that resource was not found. Of course, I configured IIS 6 for handling all requests via aspnet_isapi.dll and I have registered custom model binder in my web app's Global.asax inside Application_Start() method.
Can someone explain me what might be the cause? Thank you.
This doesn't directly answer your question, but I would suggest you try Fiddler, and look at the actual request that is being sent by the browser. Compare the differences and try to figure out what's going wrong (you can use the "Request Builder" tab in Fiddler to eh-hm, fiddle with the parameters).
What I discovered is that two methods of WebRequest: Create and CreateHttp behave differently when using HTTPS. Always use Create method to instantiate the right request according to a protocol.
I had similar situation and that what I've got. For the following code we have Not Found exception when trying to get some content using WebRequest:
HttpWebRequest request = WebRequest.CreateHttp(uri);
But the following piece works well:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
Ok, I found a way to solve this problem. In my silverlight app I opted for using client stack instead of using default http stack.
WebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp);
WebRequest.RegisterPrefix("https://", WebRequestCreator.ClientHttp);
See also: http://blogs.msdn.com/b/silverlight_sdk/archive/2009/08/12/new-networking-stack-in-silverlight-3.aspx