我一直在看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>
有什么想法吗?我一直在墙上敲我的头,而我正在制作的洞正在变大。
提前谢谢!答案 0 :(得分:7)
我为Windows / Temp文件夹提供了IIS_IUSRS读写权限,并且有效
答案 1 :(得分:1)
我遇到了类似的问题。 IIS在特定计算机上出现问题,将服务移动到另一台计算机可能会暴露此问题。此外,尝试让Windows重新安装IIS以查看是否能解决问题。