【问题标题】:Configuring WCF Service on IIS在 IIS 上配置 WCF 服务
【发布时间】:2012-01-23 18:05:07
【问题描述】:

这是我第一次使用 WCF。开发应用程序非常容易,但是部署在 IIS 上让我抓狂。

我已经尝试了一切来部署它,但是客户端开始将未经授权的用户异常(或类似的东西)抛出给未定义的异常(在 web.config 文件和 app.config 文件进行了无数次更改之后)。

我回到了在 VS (cassini) 中可以正常工作的默认配置。

任何快速指针或详细教程的链接将不胜感激。

提前致谢

<system.serviceModel>
    <services>
      <service behaviorConfiguration="MBTService.Service1Behavior"
        name="MBTService.MBTService">
        <endpoint address="" binding="wsHttpBinding" contract="MBTSTBO.IMBTService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MBTService.Service1Behavior">
          <!-- 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="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

【问题讨论】:

  • @Davide Piras - 我看过那个教程,但对我帮助不大。
  • 如果部署在 IIS (Windows Server 2008) 上,您必须先安装 WCF ... 控制面板 > 服务器管理器 > 添加功能 > .NET {版本} > WCF ... 打开 HTTP和 WCF 的 NON-HTTP 选项...根据您的 web.config 中 HTTP 与 HTTPS 设置的复杂性,还有 7 多个差异
  • .. 如果您对此有真正的具体问题,请随时通过 yahoo dot com 的 wcfguy 给我发电子邮件 .. 虽然我要到晚上才会查看我的电子邮件
  • @MacGyver 我正在 Windows 7 上部署,是的,我已经安装了 WCF。事实上,我可以通过在 VS 中添加服务引用来访问它,但是在运行应用程序时会抛出异常:/

标签: c# .net wcf iis deployment


【解决方案1】:

不特定于您的情况,但是 WCF 跟踪通常是诊断 WCF 配置问题的一个非常好的工具。可以看here如何配置WCF追踪,真的很简单,WCF运行时基本会发出一些信息到.svclog文件中

然后您可以使用Service Trace Viewer Tool 分析日志(它在所有程序->Visual Studio 2010->Microsoft Windows SDK 工具中),并查看在特定请求期间出了什么问题,它提供的信息比异常多得多消息。

【讨论】:

    【解决方案2】:

    乔尼,

    这是一个很长的镜头,但是一旦我遇到了同样的问题(未经授权的访问)并且问题是某些文件(从网络邮件下载)被 Windows 阻止了。一旦我解锁了这些文件,网络服务就开始正常工作了。

    希望对你有帮助。

    【讨论】:

      猜你喜欢
      • 2011-10-04
      • 2011-09-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-06
      • 1970-01-01
      相关资源
      最近更新 更多