【问题标题】:Metadata contains a reference that cannot be resolved元数据包含无法解析的引用
【发布时间】:2012-01-12 19:58:34
【问题描述】:

我在 SO 上查看了一大堆其他帖子,但没有一个解决了我的问题。

我已经在本地机器上的 IIS 中设置了 WCF Web 服务,我可以正常浏览它,但是当我尝试将其添加为服务引用时出现此错误:

Metadata contains a reference that cannot be resolved: 'http://[Machine Name]/AccessSetupService/WebServices.Services.AccessSetupService.svc?wsdl'.
The WSDL document contains links that could not be resolved.
There was an error downloading 'http://[Machine Name]/AccessSetupService/WebServices.Services.AccessSetupService.svc?xsd=xsd0'.
The underlying connection was closed: An unexpected error occurred on a receive.
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
An existing connection was forcibly closed by the remote host
Metadata contains a reference that cannot be resolved: 'http://[Machine Name]/AccessSetupService/WebServices.Services.AccessSetupService.svc'.
Metadata contains a reference that cannot be resolved: 'http://[Machine Name]/AccessSetupService/WebServices.Services.AccessSetupService.svc'.
If the service is defined in the current solution, try building the solution and adding the service reference again.

具体来说,我不明白为什么它说它无法解析http://[Machine Name]/AccessSetupService/WebServices.Services.AccessSetupService.svc,而这是我正在浏览的确切地址。

这是我的配置文件:

<configuration>
  <system.web>
    <compilation debug="true"/>
  </system.web>
  <system.serviceModel>
    <services>
      <service name="WebServices.Services.AccessSetupService">
        <endpoint address="" binding="wsHttpBinding" contract="WebServices.Services.IAccessSetupV1">
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange">
        </endpoint>
        <host>
          <baseAddresses>
            <add baseAddress="http://[Machine Name]/AccessSetupService/WebServices.Services.AccessSetupService.svc"/>
          </baseAddresses>
        </host>
      </service>
    </services>
    <bindings>
      <wsHttpBinding>
        <binding name="wsHttpBinding"></binding>
      </wsHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="True"/>
          <serviceDebug includeExceptionDetailInFaults="True"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

编辑:这是 WSDL:

<wsdl:definitions name="AccessSetupService" targetNamespace="http://tempuri.org/">
  <wsp:Policy wsu:Id="WSHttpBinding_IAccessSetupV1_policy">
    <wsp:ExactlyOne>
      <wsp:All>
        <sp:SymmetricBinding>
          <wsp:Policy>
            <sp:ProtectionToken>
              <wsp:Policy>
                <sp:SecureConversationToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
                  <wsp:Policy>
                    <sp:RequireDerivedKeys/>
                    <sp:BootstrapPolicy>
                      <wsp:Policy>
                        <sp:SignedParts>
                          <sp:Body/>
                          <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing"/>
                          <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing"/>
                          <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing"/>
                          <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing"/>
                          <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing"/>
                          <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing"/>
                          <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing"/>
                        </sp:SignedParts>
                        <sp:EncryptedParts>
                          <sp:Body/>
                        </sp:EncryptedParts>
                        <sp:SymmetricBinding>
                          <wsp:Policy>
                            <sp:ProtectionToken>
                              <wsp:Policy>
                                <sp:SpnegoContextToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
                                  <wsp:Policy>
                                    <sp:RequireDerivedKeys/>
                                  </wsp:Policy>
                                </sp:SpnegoContextToken>
                              </wsp:Policy>
                            </sp:ProtectionToken>
                            <sp:AlgorithmSuite>
                              <wsp:Policy>
                                <sp:Basic256/>
                              </wsp:Policy>
                            </sp:AlgorithmSuite>
                            <sp:Layout>
                              <wsp:Policy>
                                <sp:Strict/>
                              </wsp:Policy>
                            </sp:Layout>
                            <sp:IncludeTimestamp/>
                            <sp:EncryptSignature/>
                            <sp:OnlySignEntireHeadersAndBody/>
                          </wsp:Policy>
                        </sp:SymmetricBinding>
                        <sp:Wss11>
                          <wsp:Policy/>
                        </sp:Wss11>
                        <sp:Trust10>
                          <wsp:Policy>
                            <sp:MustSupportIssuedTokens/>
                            <sp:RequireClientEntropy/>
                            <sp:RequireServerEntropy/>
                          </wsp:Policy>
                        </sp:Trust10>
                      </wsp:Policy>
                    </sp:BootstrapPolicy>
                  </wsp:Policy>
                </sp:SecureConversationToken>
              </wsp:Policy>
            </sp:ProtectionToken>
            <sp:AlgorithmSuite>
              <wsp:Policy>
                <sp:Basic256/>
              </wsp:Policy>
            </sp:AlgorithmSuite>
            <sp:Layout>
              <wsp:Policy>
                <sp:Strict/>
              </wsp:Policy>
            </sp:Layout>
            <sp:IncludeTimestamp/>
            <sp:EncryptSignature/>
            <sp:OnlySignEntireHeadersAndBody/>
          </wsp:Policy>
        </sp:SymmetricBinding>
        <sp:Wss11>
          <wsp:Policy/>
        </sp:Wss11>
        <sp:Trust10>
          <wsp:Policy>
            <sp:MustSupportIssuedTokens/>
            <sp:RequireClientEntropy/>
            <sp:RequireServerEntropy/>
          </wsp:Policy>
        </sp:Trust10>
        <wsaw:UsingAddressing/>
      </wsp:All>
    </wsp:ExactlyOne>
  </wsp:Policy>
  <wsp:Policy wsu:Id="WSHttpBinding_IAccessSetupV1_Configure_Input_policy">
    <wsp:ExactlyOne>
      <wsp:All>
        <sp:SignedParts>
          <sp:Body/>
          <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing"/>
          <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing"/>
          <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing"/>
          <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing"/>
          <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing"/>
          <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing"/>
          <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing"/>
        </sp:SignedParts>
        <sp:EncryptedParts>
          <sp:Body/>
        </sp:EncryptedParts>
      </wsp:All>
    </wsp:ExactlyOne>
  </wsp:Policy>
  <wsp:Policy wsu:Id="WSHttpBinding_IAccessSetupV1_Configure_output_policy">
    <wsp:ExactlyOne>
      <wsp:All>
        <sp:SignedParts>
          <sp:Body/>
          <sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing"/>
          <sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing"/>
          <sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing"/>
          <sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing"/>
          <sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing"/>
          <sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing"/>
          <sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing"/>
        </sp:SignedParts>
        <sp:EncryptedParts>
          <sp:Body/>
        </sp:EncryptedParts>
      </wsp:All>
    </wsp:ExactlyOne>
  </wsp:Policy>
  <wsdl:types>
    <xsd:schema targetNamespace="http://tempuri.org/Imports">
      <xsd:import schemaLocation="http://[Machine Name]/AccessSetupService/WebServices.Services.AccessSetupService.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="IAccessSetupV1_Configure_InputMessage">
    <wsdl:part name="parameters" element="tns:Configure"/>
  </wsdl:message>
  <wsdl:message name="IAccessSetupV1_Configure_OutputMessage">
    <wsdl:part name="parameters" element="tns:ConfigureResponse"/>
  </wsdl:message>
  <wsdl:portType name="IAccessSetupV1">
    <wsdl:operation name="Configure">
      <wsdl:input wsaw:Action="http://tempuri.org/IAccessSetupV1/Configure" message="tns:IAccessSetupV1_Configure_InputMessage"/>
      <wsdl:output wsaw:Action="http://tempuri.org/IAccessSetupV1/ConfigureResponse" message="tns:IAccessSetupV1_Configure_OutputMessage"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="WSHttpBinding_IAccessSetupV1" type="tns:IAccessSetupV1">
    <wsp:PolicyReference URI="#WSHttpBinding_IAccessSetupV1_policy"/>
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="Configure">
      <soap12:operation soapAction="http://tempuri.org/IAccessSetupV1/Configure" style="document"/>
      <wsdl:input>
        <wsp:PolicyReference URI="#WSHttpBinding_IAccessSetupV1_Configure_Input_policy"/>
        <soap12:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <wsp:PolicyReference URI="#WSHttpBinding_IAccessSetupV1_Configure_output_policy"/>
        <soap12:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="AccessSetupService">
    <wsdl:port name="WSHttpBinding_IAccessSetupV1" binding="tns:WSHttpBinding_IAccessSetupV1">
      <soap12:address location="http://[Machine Name]/AccessSetupService/WebServices.Services.AccessSetupService.svc"/>
      <wsa10:EndpointReference>
        <wsa10:Address>http://[Machine Name]/AccessSetupService/WebServices.Services.AccessSetupService.svc</wsa10:Address>
        <Identity>
          <Spn>host/[Machine Name]</Spn>
        </Identity>
      </wsa10:EndpointReference>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

有什么想法吗?我一直在用头撞墙上,我正在做的洞越来越大。

提前谢谢!

【问题讨论】:

  • 您可以发布 WSDL 吗? http://[Machine Name]/AccessSetupService/WebServices.Services.AccessSetupService.svc?wsdl

标签: wcf


【解决方案1】:

我授予 IIS_IUSRS 对 Windows/Temp 文件夹的读写权限,并且它起作用了

【讨论】:

  • 谢谢!!我认为这很愚蠢……毕竟是 M$ :p
【解决方案2】:

我遇到了和这个类似的问题。特定机器上的 IIS 存在问题,将服务移动到另一台机器可能会暴露此问题。另外,请尝试让 Windows 重新安装 IIS,看看是否能解决问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-08-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-24
    • 2013-10-18
    • 1970-01-01
    相关资源
    最近更新 更多