I'm having problems with Proxy Generation in VS2010.
I have created a Client/Server app using WCF and the Pub/Sub pattern particularly. The service works well locally but while I can launch the service on the server and can access it through the relevent url's through my browser I cannot "Configure Service Reference" without getting the error below:
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.
What I find confusing is that I can get the code to work when I use the svcutil.exe tool and generate the proxies manually, my problem with this appproach is that its not as clean, as the VS2010 proxies and they dont implement the iNotifyPropertyChanged interface.
Could this be the firewall settings on the server thats blocking the access? Is there a shortcut to changing the machine name I'm binding against in the Proxies generated locally?
My app.config on the server side is:
<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>
Any thoughts on where i'm going wrong?
First off, you don't need to "Configure Service Reference" after you develop. Only change the address point in the web.config
or app.config
.
Second, check on the server part if the mex
end point is configured, otherwise you won't be able to create other clients.
And finally, when you try to access the WSDL for the service use one of the two notations:
http://server:port/service?wsdl
or
http://server:port/service/mex