Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/260.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
C# 如何将Windows身份验证添加到WCF应用程序_C#_.net_Wcf - Fatal编程技术网

C# 如何将Windows身份验证添加到WCF应用程序

C# 如何将Windows身份验证添加到WCF应用程序,c#,.net,wcf,C#,.net,Wcf,我目前在C#从事一个WCF项目。我对整个.NET领域相当陌生,因为我通常都在做Java,所以请允许我问一个简单的问题: 如何使我的应用程序请求使用Windows密码的凭据(HTTP摘要/Basic)?我在谷歌上搜索了很多次,但很多信息都是误导性的 以下是my web.config当前的外观: <?xml version="1.0"?> <configuration> <system.web> <compilation debug="true

我目前在C#从事一个WCF项目。我对整个.NET领域相当陌生,因为我通常都在做Java,所以请允许我问一个简单的问题:

如何使我的应用程序请求使用Windows密码的凭据(HTTP摘要/Basic)?我在谷歌上搜索了很多次,但很多信息都是误导性的

以下是my web.config当前的外观:

<?xml version="1.0"?>
<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </modules>
  </system.webServer>

  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
    <standardEndpoints>
      <webHttpEndpoint>
        <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true">
        </standardEndpoint>
      </webHttpEndpoint>
    </standardEndpoints>
  </system.serviceModel>

</configuration>

试试这个:

向下滚动到XML片段

请注意绑定设置中的安全模式:

      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Windows" />
      </security>