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
Asp.net 仅在internet上发生WCF错误_Asp.net_Wcf - Fatal编程技术网

Asp.net 仅在internet上发生WCF错误

Asp.net 仅在internet上发生WCF错误,asp.net,wcf,Asp.net,Wcf,我有一个WCF问题。我被困在这里好几天了 我有我的WCF服务和客户在内联网上完美地工作。 我在通过internet公开的IIS服务器上部署了相同的服务/客户端。这项服务,我能够完全从我的工作状态,使用互联网网站.com地址访问 然而,当使用未连接到我们网络的计算机访问同一个.com站点时,我会担心HTTP请求未经客户端身份验证方案“协商”授权。访问服务时,从服务器接收的身份验证标头为“协商,NTLM” 其他信息:客户对我进行身份验证。当客户端访问WCF服务时,我得到了错误 客户端Web.Conf

我有一个WCF问题。我被困在这里好几天了

我有我的WCF服务和客户在内联网上完美地工作。 我在通过internet公开的IIS服务器上部署了相同的服务/客户端。这项服务,我能够完全从我的工作状态,使用互联网网站.com地址访问 然而,当使用未连接到我们网络的计算机访问同一个.com站点时,我会担心HTTP请求未经客户端身份验证方案“协商”授权。访问服务时,从服务器接收的身份验证标头为“协商,NTLM” 其他信息:客户对我进行身份验证。当客户端访问WCF服务时,我得到了错误

客户端Web.Config:

<system.serviceModel>
  <bindings>
   <basicHttpBinding>
    <binding name="BasicHttpEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00"
     receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="true"
     bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
     maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
     messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
     useDefaultWebProxy="true">
     <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
      maxBytesPerRead="4096" maxNameTableCharCount="16384" />
     <security mode="TransportCredentialOnly">
      <transport clientCredentialType="Windows" proxyCredentialType="None"
       realm="" />
      <message clientCredentialType="UserName" algorithmSuite="Default"  />
     </security>
    </binding>
   </basicHttpBinding>
  </bindings>
  <client>
   <endpoint address="http://exposedoutside.com:80/site/myservice.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpEndpoint"
    contract="WFLServiceReference.IWorkflow" name="BasicHttpEndpoint" />
  </client>
   <behaviors>
     <endpointBehaviors>
       <behavior name="">
         <dataContractSerializer maxItemsInObjectGraph="2147483646"/>
         <clientCredentials>
           <windows allowedImpersonationLevel="Impersonation"/>
         </clientCredentials>
       </behavior>
     </endpointBehaviors>
   </behaviors>
 </system.serviceModel>
我错过什么了吗


提前感谢。

确保IIS已设置为允许在该Web应用程序上进行匿名身份验证。您希望自己处理身份验证,因此需要告诉IIS允许所有人进行身份验证。这是一件可以做的事情,只要您确信自己的身份验证做得很好


它在本地计算机上工作,因为它正在使用windows域凭据登录。最简单的检查方法是在web浏览器中打开WCF端点,即在地址栏中键入,您不能在Internet上使用clientCredentialType=Windows协商。仅当客户端和服务器位于同一个域或受信任域中时,它才起作用。如果您确实希望windows帐户通过Internet进行身份验证,则必须公开clientCredentialType设置为Basic的端点。它将使用基本身份验证,因此客户端必须显式提供用户名和密码。请注意,在没有传输安全HTTPS的情况下公开这样的端点是不可接受的,因为您将以纯文本形式通过Internet向网络发送凭据。

显然,我只需要传递凭据。我一直在避免这样做,但似乎这确实是一条路要走:


clientProxyHere.ClientCredentials.HttpDigest.ClientCredential=New System.Net.NetworkCredentialuser,password

感谢您的回复。然而,我想在客户端应用程序上使用Windows身份验证,我也尝试启用匿名,同样的事情发生了。我还尝试打开端点,它可以从未连接到网络的计算机访问。抱歉,误读了您的帖子。启用匿名时,需要关闭所有其他选项。您可能需要使用集成和摘要。如果连接的计算机位于同一个域上,则通常为集成。谢谢您的建议。我确实试过了。以下是我更改的内容:服务器:客户端:。。。此外,在IIS中,只有摘要身份验证对这两者都启用。结果-客户端和服务器都在独立工作。当客户端访问服务器时,我得到这样一个结果:HTTP请求未经客户端身份验证方案“摘要”授权。从服务器接收到的身份验证标头为'Digest qop=auth,algorithm=MD5 sess,nonce=+Upgraded+V14C9E77B4C1F5DB61E5DC59D598C6CB013881360BEF99418BFC93238CB76F46AFD6A53CB8FC0F3E96FC402E3DE0C7765AA7,字符集=utf-8,领域=Digest'。嗯,现在是摘要对摘要。仍然无法访问…谢谢。我现在把它改成了“消化”。结果-客户端和服务器都在独立工作。当客户端访问服务器时,我得到这样一个结果:HTTP请求未经客户端身份验证方案“摘要”授权。从服务器接收到的身份验证标头为'Digest qop=auth,algorithm=MD5 sess,nonce=+Upgraded+V14C9E77B4C1F5DB61E5DC59D598C6CB013881360BEF99418BFC93238CB76F46AFD6A53CB8FC0F3E96FC402E3DE0C7765AA7,字符集=utf-8,领域=Digest'。嗯,现在是摘要对摘要。仍然无法访问。。。
Dim wcfService = New WCFServiceProxy.myserviceClient()
wcfService.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation