當我導航到我的WCF svc頁面https://mywebstie.project.com/myproject/myuploadservice.svc,我按預期擊中了svc,但它提供的svcutil URL使用實際的服務器名稱;例如,不是mywebsite.project.com URL。爲什麼我無法查看我的WCF服務的WSDL的內容?
當我按照提供的WSDL文件鏈接時,瀏覽器中只顯示文本https://mywebstie.project.com/myproject/myuploadservice.svc/SQLMembershipProvider。瀏覽器中的URL實際上是使用服務器名稱而不是mywebstie.project.com。
WSDL XML的內容不呈現。
問題是什麼?我沒有改變我的客戶端或服務器配置,但我的服務無法正常工作。
接收到對https://mywebstie.project.com/myproject/myuploadservice.svc/SqlMembershipProvider的HTTP響應時發生錯誤。這可能是由於服務端點綁定不使用HTTP協議。這也可能是由於HTTP請求上下文被服務器中止(可能是由於服務關閉)。查看服務器日誌獲取更多詳細信
這裏是我的服務器配置
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MembershipBehaviour">
<serviceMetadata httpsGetEnabled="true" />
<serviceCredentials>
<serviceCertificate findValue="44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44"
storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint" />
<userNameAuthentication userNamePasswordValidationMode="MembershipProvider"
membershipProviderName="SqlMembershipProvider" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="SqlMembershipProvider">
<security mode="TransportWithMessageCredential">
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
<mexHttpsBinding>
<binding name="mex" />
</mexHttpsBinding>
</bindings>
<services>
<service behaviorConfiguration="MembershipBehaviour" name="Test.Web.Services.MyUploadService">
<endpoint name="SqlMembershipProvider"
address="https://mywebstie.project.com/myproject/myuploadservice.svc/SQLMembershipProvider"
binding="wsHttpBinding" bindingConfiguration="SqlMembershipProvider"
contract="Test.Web.Services.IMyUploadService" />
<endpoint address="mex" binding="mexHttpsBinding" bindingConfiguration="mex" name="mex" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
客戶看起來是這樣的:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="SqlMembershipProvider" 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"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="Certificate" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://mywebstie.project.com/myproject/myuploadservice.svc/SQLMembershipProvider"
binding="wsHttpBinding" bindingConfiguration="SqlMembershipProvider"
contract="IHoldingFileUploadService" name="SqlMembershipProvider">
<identity>
<certificate encodedValue="SomeEncodedValue" />
</identity>
</endpoint>
</client>
</system.serviceModel>
你是對的。有趣。謝啦。 – topwik 2010-09-29 14:39:53
我想這不是我的服務不工作的原因。我以爲因爲我無法看到wsdl某處出現錯誤配置。乾杯。 – topwik 2010-09-29 14:40:39
是的。你在配置上有一些問題。我認爲你的服務已經配置一點。 – 2010-09-29 14:56:53