我創建了一個測試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