为什么我无法查看 WCF 服务的 WSDL 内容?

发布于 2024-09-26 01:28:40 字数 4647 浏览 6 评论 0原文

当我导航到 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/ 的 HTTP 响应时发生错误myuploadservice.svc/SqlMembershipProvider。这可能是由于服务端点绑定不使用 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>

when i navigate to my WCF svc page https://mywebstie.project.com/myproject/myuploadservice.svc, i hit the svc as expected but the svcutil URL it supplies uses the actual server name; not the mywebsite.project.com URL, for example.

When i follow the provided link to the WSDL file, only the text https://mywebstie.project.com/myproject/myuploadservice.svc/SQLMembershipProvider is rendered in the browser. The URL in the browser is actually using the server name instead of mywebstie.project.com.

The contents of the WSDL XML are not rendered.

What might the problem be? i haven't changed my client or server configurations but my service is not working.

An error occurred while receiving the HTTP response to https://mywebstie.project.com/myproject/myuploadservice.svc/SqlMembershipProvider. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.

Here's my server config

  <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>

The client looks like this:

<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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

单挑你×的.吻 2024-10-03 01:28:40

对于您的 WSDL 问题:浏览 WSDL 时不要使用 Chrome。

For your WSDL problem: Don't use Chrome when browsing WSDL.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文