当我导航到我的 WCF svc 页面https://mywebstie.project.com/myproject/myuploadservice.svc时,我按预期点击了 svc,但它提供的 svcutil URL 使用了实际的服务器名称;例如,不是 mywebsite.project.com URL。
当我按照提供的 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>