开发者

Silverlight WebRequest fails with "The URI prefix is not recognized"

开发者 https://www.devze.com 2022-12-19 18:34 出处:网络
I have a silverlight library that is supposed to get make a web service request and receive an xml response:

I have a silverlight library that is supposed to get make a web service request and receive an xml response:

   Uri uri = new Uri("http://some_server:51306/getStuff.xml?id=14");            
   WebRequest request = WebRequest.Create(uri);

However, WebRequest.Create(uri) fails with the exception "The URI prefix is not recognized".

Note that I am running the program using a unit test from a non-silverli开发者_开发百科ght dll. I need to build a test suite for the app!

Any ideeas?


Try setting the .Web project as the default startup project instead of the Silverlight project


Have you tried adding the second parameter to the Uri constructor?

 Uri uri = new Uri("http://some_server:51306/getStuff.xml?id=14", UriKind.Absolute);  
0

精彩评论

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

关注公众号