我正在开发一个使用asp.net编写的简单Web服务的wp7应用程序
Web服务在桌面应用程序中运行良好(用c#编写)(也在Web浏览器中测试过,工作正常)但在wp7中无效。
以下是我在wp7中用来调用webservice的代码
BookService.BooklocationSoapClient client = new BookService.BooklocationSoapClient();
client.BookListCompleted += new EventHandler<BookService.BookListCompletedEventArgs>(client_BookListCompleted);
client.BookListAsync(dId);
void client_BookListCompleted(object sender, BookService.BookListCompletedEventArgs e)
{
Debug.WriteLine(e.Result);
}
以下是我得到的例外
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Net.WebException' occurred in System.Windows.dll
A first chance exception of type 'System.Net.WebException' occurred in System.Windows.dll
A first chance exception of type 'System.ServiceModel.FaultException' occurred in System.ServiceModel.dll
A first chance exception of type 'System.ServiceModel.FaultException' occurred in System.ServiceModel.dll
另外,我收到以下消息
Server was unable to process request. ---> Length cannot be less than zero.
Parameter name: length
答案 0 :(得分:0)
似乎您尝试在开发人员计算机上调用本地Web服务,这是不允许的 Windows手机模拟器。 尝试拨打互联网上提供的任何公共网络服务,例如天气预报