.net 试图在非域VM上运行WCF web服务,出现安全错误

.net 试图在非域VM上运行WCF web服务,出现安全错误,.net,wcf,visual-studio-2010,.net-4.0,wcf-security,.net,Wcf,Visual Studio 2010,.net 4.0,Wcf Security,我在这里陷入了第二十二条军规的境地吗?我的目标是采用我继承的WCF服务,在虚拟机上运行它,并通过从桌面PC调用它来测试它。虚拟机位于工作组中,而不是公司的域中。基本上,我们需要更多的测试环境,最好是每个开发人员一个(我们可能有2到4个人需要)。因此,虚拟机的想法是,每个开发人员都可以拥有自己的web服务器,该服务器在某种程度上与真实环境相匹配(我们实际上有两个网站,一个是外部/公开的,一个是内部的)。 [使用VS2010.NET 4.0] <bindings> <wsHtt

我在这里陷入了第二十二条军规的境地吗?我的目标是采用我继承的WCF服务,在虚拟机上运行它,并通过从桌面PC调用它来测试它。虚拟机位于工作组中,而不是公司的域中。基本上,我们需要更多的测试环境,最好是每个开发人员一个(我们可能有2到4个人需要)。因此,虚拟机的想法是,每个开发人员都可以拥有自己的web服务器,该服务器在某种程度上与真实环境相匹配(我们实际上有两个网站,一个是外部/公开的,一个是内部的)。 [使用VS2010.NET 4.0]

<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />
在内部服务中,每个方法都用以下属性修饰:

 [OperationBehavior(Impersonation = ImpersonationOption.Required)]
<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />
我还在研究为什么需要这个。我认为这是因为一个webapp调用了“内部”服务,要么a)我们需要用户的凭据,要么b)我们可能会进行一些原则性许可。要求查看用户是否在一个组中。我的兴趣是创建一些ConsoleTest程序或UnitTest程序

<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />
我改成这样:

 [OperationBehavior(Impersonation = ImpersonationOption.Allowed)]
<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />
因为我在尝试在浏览器中查看.svc时出错:

<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />
协定操作“EditAccountFamily”需要Windows标识才能进行自动模拟。绑定('WSHttpBinding','不提供表示调用方的Windows标识http://tempuri.org/合同('IAdminService','http://tempuri.org/"

<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />
我不认为原始绑定会出现这样的错误:

 [OperationBehavior(Impersonation = ImpersonationOption.Allowed)]
<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />

<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />
但是,我认为我需要关闭此安全性,因为web服务不在域上

<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />

<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />
我倾向于在客户端出现以下错误:

<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />
1) 无法满足对安全令牌的请求,因为身份验证失败-作为“SecurityNegotiation未处理”的内部异常

<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />

<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />
2) 服务未对调用方进行身份验证,这是“SecurityNegotiation未处理”的InnerException

<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />
那么,我可以创建一些代码和web.config的配置来允许每个开发人员在自己的VM上工作吗?或者我必须将VM加入域

<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />
排列的数量似乎无穷无尽。我已经开始创建一个Word.doc来说明如何处理每个错误,但现在我陷入了困境

<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />
谢谢

<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />
尼尔

<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />

服务器绑定:

<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />

<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />

尝试从服务器和客户端绑定中删除安全元素

<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />

问题可能是由于服务器和客户端安全元素之间不匹配。通常,当WCF出现问题时,是因为绑定配置中的错误。一个好的故障排除策略是删除所有不必要的配置元素,然后尝试逐个添加它们,从而隔离问题。

您在问题中指出:

<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />
…虚拟机的想法是 开发者可以有自己的网站 有点符合我们真实需求的服务器 环境

<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />
我的观点是,在您将应用程序放到域之前,您在使用Windows身份验证的VM上安装的每个应用程序都会遇到类似的问题。我不认为这是WCF特有的问题。这是一个信任来自不受信任域的凭据的问题。另外,我假设您的真实环境位于域上,因此为了真正匹配环境,您的虚拟机也应该位于域上

<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />
(评论回复):我只是假设你可能有不止一份申请。我可能错了。但是,如果在ASP.NET中使用Windows身份验证,则会出现此问题

<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />

最不理想的情况是在应用程序和服务中使用自定义代码,以便它们在特殊的测试/开发环境中运行。

请发布您的客户端和服务器绑定。将VM放到域上是不可能的吗?如果我有一个个人测试服务器,我希望它在域上,特别是如果我对任何事情使用Windows身份验证。您可能也会在其他应用程序中遇到类似的问题。@Aaron-这就是我的想法,它必须在域上,但您可能会引用哪些其他应用程序?不,这不是不可能的,只是更多的政治,防火墙,等等…这种方法让我在几天内一事无成,所以我决定在这里发帖。注释掉这两个标记的结果几乎相同:异常:{“调用方未通过服务的身份验证。”}内部:{“由于身份验证失败,无法满足对安全令牌的请求。”}如果程序具有[OperationBehavior(Impersonation=ImpersonationOption.Required)]在每个方法上-那么我们如何关闭安全性?如果未传递某些用户权限,则无法模拟?这就是我所指的第二十二条军规的概念。我以为你把它设置为模仿。允许吗?这里没有第22条军规,我在工作组上使用模拟设置了WCF-没有问题。如果设置了模拟,会发生什么?允许吗?@Neal:这看起来很明显,但是客户端的用户名也是服务器上的用户名吗?这是NTLM工作所必需的。
<bindings>
  <wsHttpBinding>
    <binding
      name="wsHttpEndpointBinding"
      maxBufferPoolSize="2147483647"
      maxReceivedMessageSize="500000000">
      <readerQuotas
        maxDepth="2147483647"
        maxStringContentLength="2147483647"
        maxArrayLength="2147483647"
        maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" />
      <!-- <security mode="None" />  This is one thing I tried --> 
      <security>
        <message
          clientCredentialType="Windows" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>


    <behavior
      name="ABC.AdminService.AdminServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and 
           remove the metadata endpoint above before deployment -->
      <serviceMetadata
        httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  
           Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug
        includeExceptionDetailInFaults="true" />
      <serviceCredentials>
      </serviceCredentials>
      <!--<serviceAuthorization principalPermissionMode="UseAspNetRoles" 
            roleProviderName="AspNetWindowsTokenRoleProvider"/>-->
      <serviceAuthorization
        principalPermissionMode="UseWindowsGroups"
        impersonateCallerForAllOperations="true" />
    </behavior>

  </serviceBehaviors>

</behaviors>


<serviceHostingEnvironment
  multipleSiteBindingsEnabled="true" />