首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >被https中的WCF服务"The remote server returned an error:(403) Forbidden“搞糊涂了

被https中的WCF服务"The remote server returned an error:(403) Forbidden“搞糊涂了
EN

Stack Overflow用户
提问于 2010-06-03 04:09:17
回答 6查看 31.8K关注 0票数 12

我有一个WCF服务,我已经归结为几乎没有,因为这个错误。它快把我逼疯了。这就是我现在所拥有的。

一个非常简单的WCF服务,只有一个方法可以返回值为"test“的字符串。

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

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

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

我将WCF服务发布到它的https位置

我在VS中以调试模式运行web应用程序,它工作得很好。

我将web应用程序发布到WCF服务所在的同一服务器上的https位置,该服务器位于同一SSL证书下

我得到“远程服务器返回错误:(403)禁止”

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

以下是WCF服务和WEB应用程序的web.config中的设置:

这个问题似乎与Web应用程序有关,但我没有办法了。任何想法:

WCF服务:

代码语言:javascript
复制
  <system.serviceModel>
<bindings>
代码语言:javascript
复制
<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应用:

代码语言:javascript
复制
    <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>
代码语言:javascript
复制
<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>

代码语言:javascript
复制
  </client>
</system.serviceModel>
EN

回答 6

Stack Overflow用户

回答已采纳

发布于 2010-06-04 00:44:45

在花了很多时间在这个问题上之后,我将回答我自己的问题。我希望这篇文章能帮助所有其他试图弄清楚这一点的人。我们终于让网络管理员参与进来,并解决了这个问题。

以下是场景和解决方案:

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

所有的设置都是相同的,或者说我们是这么认为的。

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

票数 4
EN

Stack Overflow用户

发布于 2016-09-28 05:37:49

在我的例子中,我从另一台机器复制了源代码,并且虚拟目录没有在这里创建。一旦我转到项目属性并创建了虚拟目录,它就可以正常工作了。

票数 1
EN

Stack Overflow用户

发布于 2017-12-06 04:09:36

确保设置了compilation debug="true"

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2961225

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档