WCF REST API:错误400

时间:2016-02-04 15:43:03

标签: c# wcf rest

我刚刚开发了一个我用AngularJS调用的WCF服务。过了一会儿,我注意到我需要用户通过Windows凭据验证自己。因此,我打开了“Windows身份验证”模式并关闭了“匿名身份验证”。当我在浏览中调用我的服务时,我被提示自己登录,但是当我这样做时,我得到一个空白的回复。当我检查它的状态时,我得到一个400.这是我的web.config:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.web>
    ...
    <authentication mode="Windows" />
    <authorization>
      <deny users="?"/>
    </authorization>
  </system.web>
  <system.webServer>
    ...
  </system.webServer>
  <system.serviceModel>

    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpEndpointBinding">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />

    <services>      
      <service name="TeamCity.WebServices.ConfigurationService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpEndpointBinding" contract="TeamCity.Interfaces.IConfigurationService" />
      </service>
    </services>
  </system.serviceModel>
</configuration>

有没有人有想法?

0 个答案:

没有答案