2011-06-06 105 views
0

我在VS2010中发生代理生成问题。WCF代理生成问题

我已经创建了一个使用WCF和Pub/Sub模式的客户端/服务器应用程序。该服务的工作以及在本地,而我可以在服务器上通过我的浏览器我不能“配置服务引用”没有得到下面的错误启动服务,并可以通过培训相关访问的URL:

The document at the url http://cfplonbs2:8686/TradePortal was not recognized as a known document type. The error message from each known type may help you fix the problem: - Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'. - Report from 'http://cfplonbs2:8686/TradePortal' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'. - Report from 'DISCO Document' is 'There was an error downloading 'http://localhost:8686/TradePortal?disco'.'. - Unable to connect to the remote server - No connection could be made because the target machine actively refused it 127.0.0.1:8686 - Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'. Metadata contains a reference that cannot be resolved: 'http://cfplonbs2:8686/TradePortal'. There was no endpoint listening at http://cfplonbs2:8686/TradePortal 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: (404) Not Found. If the service is defined in the current solution, try building the solution and adding the service reference again.

我发现了什么困惑当我使用svcutil.exe工具并手动生成代理时,我可以使代码正常工作,但这个appproach的问题在于它不像VS2010代理那样干净,并且它们没有实现iNotifyPropertyChanged接口。

这可能是阻止访问的服务器上的防火墙设置?有没有更改我在本地生成的代理中绑定的计算机名称的快捷方式?

我在服务器端的app.config是:

<services> 
     <service behaviorConfiguration="Default" name="CFP_Web_Lib.TradePortal"> 
     <host> 
      <baseAddresses> 
      <add baseAddress="http://localhost:8686/TradePortal"/> 
      </baseAddresses> 
     </host> 
     <endpoint address="" binding="webHttpBinding" 
      contract="CFP_Web_Lib.ITradePortal" 
        behaviorConfiguration="web"/> 
     <endpoint address="Operations/" binding="wsDualHttpBinding" 
      contract="CFP_Web_Lib.ITradeOperations"/> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="Default"> 
      <serviceMetadata httpGetEnabled="true"/> 
      <serviceDebug includeExceptionDetailInFaults="true"/> 
     </behavior> 
     </serviceBehaviors> 
     <endpointBehaviors> 
     <behavior name="web"> 
      <webHttp/> 
     </behavior> 
     </endpointBehaviors> 
    </behaviors> 
    <bindings> 
     <wsDualHttpBinding> 
     <binding name="WSDualHttpBinding_IPubSubService" closeTimeout="00:01:00" 
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
      bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
      maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" 
      textEncoding="utf-8" useDefaultWebProxy="true"> 
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
      maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
      <reliableSession ordered="true" inactivityTimeout="00:10:00" /> 
      <security mode="Message"> 
      <message clientCredentialType="Windows" negotiateServiceCredential="true" 
       algorithmSuite="Default" /> 
      </security> 
     </binding> 
     </wsDualHttpBinding> 
     <mexHttpBinding> 
     <binding name="NewBinding0" /> 
     </mexHttpBinding> 
    </bindings> 

上我要去哪里错了有什么想法?

回答

0

首先,开发后不需要“Configure Service Reference”。只更改web.configapp.config中的地址点。

其次,检查服务器部分是否配置了mex端点,否则您将无法创建其他客户端。

最后,当您尝试访问WSDL为服务使用两种符号之一:

http://server:port/service?wsdl 

http://server:port/service/mex 
+0

我认为,这个问题是对的wsDualHttpBinding安全,当我更改地址时,出现安全错误。我已经将它切换到NetTcP,现在它工作正常 – 2011-06-07 09:16:27