我正在开发一个 wp7 应用程序,它使用一个用 asp.net 编写的简单 Web 服务
Web 服务在桌面应用程序(用 C# 编写)中运行良好(也在 Web 浏览器中测试并且运行良好),但在 wp7 中无法运行。
以下是我在 wp7 中用来调用 web 服务的代码
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