2010-06-02 109 views
11

我有一个WCF服务,我已经沸腾到没有什么,因为这个错误。它把我推上了墙。这是我现在拥有的。由于“远程服务器返回一个错误:(403)禁止”与WCF服务https:

一个非常简单的WCF服务,其中一个方法返回值为“test”的字符串。

一个非常简单的Web应用程序,它使用服务并将字符串的值放入标签中。

在Win 2003上使用SSL证书运行IIS 6的Web服务器。

在同一台服务器上工作的其他WCF服务。

我发布的WCF服务,它的HTTPS位置

我运行在VS调试模式下的Web App和它完美的作品。

我发布的web应用程序是HTTPS WCF服务驻留在相同的SSL证书

我得到下在同一台服务器上的位置,“远程服务器返回错误:(403)禁止”

我几乎改变了IIS中的所有设置以及WCF和Web应用程序都无济于事。我已经比较了WCF服务中的设置,它们都是一样的。

下面是在web.config中的WCF服务和Web应用程序的设置:

它出现的问题具有与Web应用程序做的,但我的想法。任何想法:

WCF服务:

<system.serviceModel> 
<bindings> 

<client /> 

<services> 
    <service behaviorConfiguration="Ucf.Smtp.Wcf.SmtpServiceBehavior" name="Ucf.Smtp.Wcf.SmtpService"> 
    <host> 
     <baseAddresses> 
     <add baseAddress="https://test.net.ucf.edu/webservices/Smtp/" /> 
     </baseAddresses> 
    </host> 
    <endpoint address="" binding="wsHttpBinding" contract="Ucf.Smtp.Wcf.ISmtpService" bindingConfiguration="SSLBinding"> 
     <identity> 
     <dns value="localhost"/> 
     </identity> 
    </endpoint> 
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/> 
    </service> 
</services> 

<behaviors> 
    <serviceBehaviors> 
    <behavior name="Ucf.Smtp.Wcf.SmtpServiceBehavior"> 
     <serviceMetadata httpsGetEnabled="true" /> 
     <serviceDebug includeExceptionDetailInFaults="true" httpsHelpPageEnabled="True"/> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 

Web应用程序:

<system.serviceModel> 
    <bindings><wsHttpBinding> 
<binding name="WSHttpBinding_ISmtpService" closeTimeout="00:01:00" 
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" 
textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> 
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
    maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
<reliableSession ordered="true" inactivityTimeout="00:10:00" 
    enabled="false" /> 
<security mode="Transport"> 
    <transport clientCredentialType="None" proxyCredentialType="None" 
    realm="" /> 
    <message clientCredentialType="Windows" negotiateServiceCredential="true" 
    establishSecurityContext="true" /> 
</security> 
</binding> 

<client> 


<endpoint address="https://net228.net.ucf.edu/webservices/smtp/SmtpService.svc" 
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ISmtpService" 
contract="SmtpService.ISmtpService" name="WSHttpBinding_ISmtpService"> 
<identity> 
<dns value="localhost" /> 
</identity> 

</client> 
</system.serviceModel> 

回答

4

我会在这个问题上花费几个小时后,回答我的问题。我希望这可以帮助所有其他曾经试图解决这个问题的人在墙上击败对手。我们终于找到了网络管理员并解决了这个问题。

这里的场景和解决方案:

我们有一个生产服务器 - 一切正常。 我们有一个测试服务器 - 我们得到一个403禁止的错误。 本地调试工作正常。

所有设置都是相同的,所以我们认为。

有一个设置是错误的。在目录安全性选项卡下web服务的虚拟目录的属性中的IIS中,第二个编辑按钮用于IP限制。我们被设置为拒绝访问所有IP,除了应该包含测试服务器IP的列表。测试网络服务器的IP没有被授予权利。它没有权利的原因是最近从生产虚拟服务器克隆了它,并且从未调整此设置以添加测试虚拟服务器。

0

,在跳出我是你逝去的Windows标识与该消息的唯一的事情,这可能会导致权限问题,如果用户帐户被传递无权访问WCF服务。可能需要在Web应用程序上模拟?

0

默认情况下,WCF绑定不允许匿名(no-auth)访问。你需要modify the bindings,使它:

<wsHttpBinding> 
    <binding ...> 
     <security mode ="None"/> 
    </binding> 
    </wsHttpBinding> 
1

在我的情况下,我从另一台机器复制了源代码,并没有在这里创建虚拟目录。一旦我去了项目属性,并创建了虚拟目录,它工作正常。

0

在我的情况下,我的apppool用户由于某种原因没有读/写访问'C:\ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ Temporary ASP.NET Files'。

0

确保您已设置compilation debug="true"

相关问题