开发者

ClientHttpWebRequest: ArgumentNullException s

I'm using Silverlight 4.0, and am trying to get a request trough https. All I get is the exception below, which is not really helpful, because no search engine finds any related solution...

request = WebRequest.Create( new Uri("https://myurl.com/myfile" ) );
asyncResult = request.BeginGetResponse();
...
request.EndGetResponse( asyncResult );

{System.ArgumentNullException ---> System.ArgumentNullException: Value cannot be null.
Parameter name: s
   at System.Net.Browser.ClientHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
   at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
   at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState)
   --- End of inner exception stack trace ---
   at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
   at System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)

It works when I use http instead of https. It works when I use the browser via https. But not like this. Any hints where to look for an answer, or even an answer would be very much appreciated.

[EDIT] Ok, I found out what seems to be the problem: apparently it has something to do with Firefox and certificates. When I run the xap in IE, it asks me to trust a c开发者_如何学编程ertificate, and then it works. In Firefox I never get such a question, and it never works (even though I downloaded the xap over that very address.) So now the question is: How do I get working https, Firefox and Silverlight to work together?

[EDIT2] I'm still on the same problem, but there is something more to it. Not only Firefox has the problem, but also out-of-browser (even if installed from IE). There is someone with a similar exception, but no answer: http://forums.silverlight.net/forums/p/210114/494451.aspx


Got it.

The problem was that the Root CA Certificate of the Server was untrusted. Because I had IE 6 installed, I did not really see the message. The exception added to Firefox did not propagate to Silverlight (because Silverlight apparently always the Global Windows Certificates).

Installing IE 8 reveals that the Root CA Certificate was untrusted right beside the address bar. Click that message, add the Root CA Certificate to the ones used by Windows and voilà, everything works, IE, OOB and Firefox.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜