0

我正在开发一个 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
4

1 回答 1

0

好像您尝试在您的开发人员机器上调用本地 Web 服务,这是 Windows Phone 模拟器不允许的。尝试调用互联网上可用的任何公共网络服务,例如天气预报

于 2013-10-13T15:03:12.630 回答