我有一個.net客戶端,我正在使用WCF服務,並且能夠成功完成。但是當我嘗試在我們的產品上發佈時,我無法使用相同的服務。下面是我的web.config:WCF服務正在開發服務器上,但在生產上它不是正在開發
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MyBehavior">
<useRequestHeadersForMetadataAddress></useRequestHeadersForMetadataAddress>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="TestProject.Implementations.AuthenticateUser,TestProject"/>
<serviceCertificate findValue="localhost" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My"/>
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="TestProject.Implementations.ServiceCustom" behaviorConfiguration="MyBehavior">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="SampleServiceBinding" contract="TestProject.Interfaces.IServiceCustom"></endpoint>
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex"></endpoint>
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="SampleServiceBinding">
<security mode ="Message">
<message clientCredentialType="UserName"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
,也是我想讓我的服務啓用HTTPS。
我得到errormessage下面: 沒有端點收聽http://url.com可以接受消息。這通常是由不正確的地址或SOAP操作引起的。有關更多詳細信息,請參閱InnerException(如果存在)。
「見InnerException,如果存在,獲取更多細節。「我們也可以看到嗎? –
您的'web.config'不包含Web服務的地址。即使如此,這個錯誤也意味着你在你的代碼中改變了目標URL,也許使用一個配置值並以'url.com'作爲默認值。如果沒有發佈導致錯誤的*實際代碼*,則無法提供幫助 –
從客戶端添加app.config或客戶端用於連接到服務的代碼。但我想問題是,您沒有爲服務於您的合同的端點指定地址。 –