Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wcf wsHttpBinding(对于路由启用https和aspNetCompatibilityEnabled)元数据错误302_Wcf_Https_Basichttpbinding_Wshttpbinding - Fatal编程技术网

Wcf wsHttpBinding(对于路由启用https和aspNetCompatibilityEnabled)元数据错误302

Wcf wsHttpBinding(对于路由启用https和aspNetCompatibilityEnabled)元数据错误302,wcf,https,basichttpbinding,wshttpbinding,Wcf,Https,Basichttpbinding,Wshttpbinding,我正在开发一个WCF服务,该服务与ASP.NET MVC 2应用程序一起运行,带有https端口,该端口已使用webMatrix ssl证书进行配置。该服务在浏览器中运行良好,还可以下载wsdl。但是,当我尝试将服务加载到wcftestclient工具以及我自己的客户端时,出现以下错误 Error: Cannot obtain Metadata from 'localhost:44300/MyService' If this is a Windows (R) Communication Foun

我正在开发一个WCF服务,该服务与ASP.NET MVC 2应用程序一起运行,带有https端口,该端口已使用
webMatrix ssl
证书进行配置。该服务在浏览器中运行良好,还可以下载wsdl。但是,当我尝试将服务加载到
wcftestclient
工具以及我自己的客户端时,出现以下错误

Error: Cannot obtain Metadata from 'localhost:44300/MyService' If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address.  For help enabling metadata publishing, please refer to the MSDN documentation at go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error    URI: localhost:44300/MyService    Metadata contains a reference that cannot be resolved: 'localhost:44300/MyService'.    The remote server returned an unexpected response: (302) Found.    Too many automatic redirections were attempted.HTTP GET Error    URI: localhost:44300/MyService    There was an error downloading 'localhost:44300/MyService'.    The request failed with the error message:--"
我已经为wcf服务路由添加了属性
aspNetCompatibilityEnabled=“true”
,如果该属性已被删除,则一切正常。最初,此服务配置为
basichttppbinding
&时也存在同样的问题。读了这篇文章后,我改为
wshttpBinding
,因为可疑的绑定也可能是问题所在,我仍然遇到同样的问题,下面是我的
web.config

你们谁能帮我修一下这个吗

<system.serviceModel>    
    <extensions>
      <behaviorExtensions>
        <add name="ExceptionBehavior" type="ServiceExceptionHander.ExceptionHandlerBehaviorExtension, ServiceExceptionHandler" />
      </behaviorExtensions>
    </extensions>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehavior">
          <serviceMetadata httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true" />
          <ExceptionBehavior />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service name="ServiceImplementation.MyService" behaviorConfiguration="ServiceBehavior">
        <endpoint binding="wsHttpBinding" bindingConfiguration="securityBinding" contract="ServiceContracts.IMyServiceContracts"/>    
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>    
      </service>
    </services>
    <bindings>
      <wsHttpBinding>
        <binding name="securityBinding">
          <security mode="Transport">
            <transport clientCredentialType="None"/>
          </security>          
        </binding>
      </wsHttpBinding>   
    </bindings>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true">
      <serviceActivations>
        <add factory="System.ServiceModel.Activation.ServiceHostFactory" service="ServiceImplementation.MyService" relativeAddress="MyService.svc"/>
      </serviceActivations>
    </serviceHostingEnvironment>    
</system.serviceModel>


您的mex端点上的引号似乎有误-可能是从Word中复制的?不管是哪种方式,试着用常规的引号替换它们,就像你在配置中的其他地方一样。嗨,zimdanen,谢谢,我已经更改并测试了它,仍然会遇到同样的问题。