Can';t在本地计算机上运行WCF服务

Can';t在本地计算机上运行WCF服务,wcf,.net-4.0,Wcf,.net 4.0,我有一个wcf服务,它只有在我将其部署到服务器并通过IIS进行配置后才能工作。通过IIS express运行时,我收到的错误消息是: 主机上配置的身份验证方案(“Ntlm,匿名”)不允许在绑定“BasicHttpBinding”(“协商”)上配置的身份验证方案。请确保SecurityMode设置为Transport或TransportCredentialOnly。此外,通过IIS管理工具,通过元素的应用程序配置文件中的ServiceHost.authentication.Authenticati

我有一个wcf服务,它只有在我将其部署到服务器并通过IIS进行配置后才能工作。通过IIS express运行时,我收到的错误消息是:

主机上配置的身份验证方案(“Ntlm,匿名”)不允许在绑定“BasicHttpBinding”(“协商”)上配置的身份验证方案。请确保SecurityMode设置为Transport或TransportCredentialOnly。此外,通过IIS管理工具,通过元素的应用程序配置文件中的ServiceHost.authentication.AuthenticationSchemes属性,通过更新绑定上的ClientCredentialType属性,更改此应用程序的身份验证方案,可以解决此问题,或者通过调整HttpTransportBindingElement上的AuthenticationScheme属性

我的web.config服务Bing如下所示:

 <services>
      <service name="LMS.Services.Services.AppService" behaviorConfiguration="LargeDataRequestBehavior">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttp_LargeDataRequestBinding" contract="LMS.Services.Services.AppService" />
        <endpoint address="mex" binding="basicHttpBinding" bindingConfiguration="basicHttp_LargeDataRequestBinding" contract="IMetadataExchange" />
      </service> </services>
   <bindings>
      <basicHttpBinding>
        <binding name="basicHttp_LargeDataRequestBinding" receiveTimeout="01:00:00" sendTimeout="01:00:00" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />          
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" >              
            </transport>
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      <basicHttpBinding>
    </bindings>

我的装订看起来像这样:

 <services>
      <service name="LMS.Services.Services.AppService" behaviorConfiguration="LargeDataRequestBehavior">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttp_LargeDataRequestBinding" contract="LMS.Services.Services.AppService" />
        <endpoint address="mex" binding="basicHttpBinding" bindingConfiguration="basicHttp_LargeDataRequestBinding" contract="IMetadataExchange" />
      </service> </services>
   <bindings>
      <basicHttpBinding>
        <binding name="basicHttp_LargeDataRequestBinding" receiveTimeout="01:00:00" sendTimeout="01:00:00" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />          
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" >              
            </transport>
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      <basicHttpBinding>
    </bindings>


任何帮助都将不胜感激。

尝试更改此部件。问题是凭据类型Windows的枚举映射到一个名为协商的协议。IIS通知您,您的网站上尚未启用协商,只允许使用基本(无安全)和Ntlm(另一种Windows安全形式)

<bindings>
  <basicHttpBinding>   
    <binding>      
      <security >
        <transport clientCredentialType="Ntlm" >              
        </transport>
      </security>
    </binding>
  </basicHttpBinding>
</bindings>


这里的WTF是“协商”和“窗口”之间不匹配。

更新IIS
身份验证设置,如下所示,修复了我的问题:

  • 匿名身份验证:
    已禁用
  • Windows身份验证:
    已启用

这确实使它起作用,但在silverlight软件包的调用端代理服务上引起了另一个问题。我现在收到此错误:由于EndpointDispatcher上的ContractFilter不匹配,因此无法在接收方处理带有操作“urn:AppService/GetTemplatesByCategory”的消息。这可能是因为合同不匹配(发送方和接收方之间的操作不匹配)或发送方和接收方之间的绑定/安全不匹配。检查发送方和接收方是否具有相同的合同和相同的约束力(inc安全要求,例如消息、传输、非尽管我最后一次发表评论,我还是错误地更改了客户端中服务的url!你好,Aron。在结束basicHttpBinding标记中缺少“/”。输入错误会导致XML无效。因此,我不允许编辑一个字符,或者我自己修复它。