[英]WCF Service and Windows Phone app while developing
我创建了一个测试WP7应用程序,该应用程序使用WCF来获取一些示例数据
我将服务添加为服务引用,并在其中生成了类。 在应用程序中,我称该服务为:
var service = new TestService.TestServiceClient();
service.GetDataCompleted += new EventHandler<TestService.GetDataCompletedEventArgs>(service_GetDataCompleted);
service.GetDataAsync(new TestService.GetDataRequest());
在服务调用的回调中,出现以下异常:
在http:// localhost:8219 / TestService.svc上没有侦听终结点的端点可以接受该消息。 这通常是由不正确的地址或SOAP操作引起的。 有关更多详细信息,请参见InnerException(如果存在)。
内部异常说:
远程服务器返回错误:NotFound。
调试时,cassini开发服务器将启动。 我可以从Internet Explorer正常访问svc,请参阅wsdl等
由Visual Studio生成的配置文件:
<?xml version="1.0" encoding="utf-8"?>
<configurationSnapshot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:schemas-microsoft-com:xml-wcfconfigurationsnapshot">
<behaviors />
<bindings>
<binding digest="System.ServiceModel.Configuration.BasicHttpBindingElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:<?xml version="1.0" encoding="utf-16"?><Data maxBufferSize="2147483647" name="BasicHttpBinding_ITestService"><security mode="None" /></Data>" bindingType="basicHttpBinding" name="BasicHttpBinding_ITestService" />
</bindings>
<endpoints>
<endpoint normalizedDigest="<?xml version="1.0" encoding="utf-16"?><Data address="http://localhost:8219/TestService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITestService" contract="TestService.ITestService" name="BasicHttpBinding_ITestService" />" digest="<?xml version="1.0" encoding="utf-16"?><Data address="http://localhost:8219/TestService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITestService" contract="TestService.ITestService" name="BasicHttpBinding_ITestService" />" contractName="TestService.ITestService" name="BasicHttpBinding_ITestService" />
</endpoints>
</configurationSnapshot>
有任何想法吗??
您是否尝试过在实际运行的电话/模拟器上从IE访问svc URI?
如果无法执行此操作,请检查电话上的代理设置。
如果是真正的电话,则仅在通过USB连接到PC时才有效。
我已经看到了一些问题,即使部署了新的代码并运行/调试了该模拟器(出于某种未知的原因),该模拟器仍然无法建立网络连接。 重新启动模拟器解决了这个问题。
好吧,这是您浪费大量时间的情况之一,因为错误消息使您无法找到解决方案。
要解决这个问题,它是组合这个再生业务的参考。 我知道这不是一个很好的答案,但这就是实际发生的情况
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.