我创建了一个测试WP7应用程序,它使用WCF来获取一些示例数据
我添加了服务作为服务引用以及生成的类。在应用中,我拨打服务:开发WCF服务和Windows Phone应用程序
var service = new TestService.TestServiceClient();
service.GetDataCompleted += new EventHandler<TestService.GetDataCompletedEventArgs>(service_GetDataCompleted);
service.GetDataAsync(new TestService.GetDataRequest());
从服务调用回调
,我得到以下异常:
There was no endpoint listening at http://localhost:8219/TestService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
内部异常说:
The remote server returned an error: NotFound.
当调试时,cassini dev服务器启动。我可以通过Visual Studio中没有问题,访问来自Internet Explorer中的SVC,看到WSDL等
生成的配置文件:
<?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>
任何想法?
请在您的文章中包含您的配置。可能配置不好以使用该实际端点。也是同样的解决方案?如果你是发现并将其添加到客户项目中的? – 2011-05-13 08:07:05
这是相同的解决方案。我做了一个发现 – 2011-05-13 08:24:40
你使用什么类型的绑定? – 2011-05-13 08:26:35