【问题标题】:web.config changes for publishing WCF service into Azure将 WCF 服务发布到 Azure 的 web.config 更改
【发布时间】:2015-12-14 05:09:52
【问题描述】:

我有一个 WCF 服务,可以离线工作 但是,当我将它发布到 Azure 时,它​​不会

http://ties532.cloudapp.net/Service1.svc

在我的 web.config 中注意 <customErrors mode="off"/>,这实际上对错误显示没有任何影响...

我知道我需要对 web.config 文件进行一些更改,这里是这样说的:

HOW TO FIX ‘RUNTIME/SERVER ERROR’ REDIRECT ISSUES

但是上面的方法只适用于Visual Studio 2012,我有2015。

问题:如何在 Visual Studio 2015 中手动定义服务的最终 URI(我猜,它会解决问题)?

我的 web.config 包含:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.diagnostics>
<trace>
  <listeners>
    <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
      name="AzureDiagnostics">
    </add>
  </listeners>
</trace>
</system.diagnostics>
<system.web>
<!--<compilation debug="true" targetFramework="4.5.2" />-->
<customErrors mode="Off"/>
</system.web>
<system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false 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>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
    To browse web app root directory during debugging, set the value below to true.
    Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>

更新 16.12

Azure 网站很糟糕。花了 2 小时修复另一个问题 - 通过 VS 部署没有错误。

通过从 web.config 中删除一个字符串并将“ encoding="utf-8" ”添加到根元素(最终配置如上)来解决。

***要从远程桌面访问您的服务 - 转到可以查看服务统计信息的应用程序(在远程桌面内部,不记得名称),然后从那里选择 IP。本地主机不适合我。

【问题讨论】:

    标签: c# asp.net .net wcf azure


    【解决方案1】:

    您可以使用远程桌面连接来连接您的云服务虚拟机。

    https://azure.microsoft.com/en-us/documentation/articles/cloud-services-nodejs-enable-remote-desktop/

    然后用VM Internet Explorer测试你的网站,我想你会有一个更详细的错误日志。

    问候,

    弗洛伦特。

    【讨论】:

    • 嗨。我在机器的IE里面。如果我使用相同的地址(ties532.cloudapp.net),它无论如何都不会改变,相同的错误日志。我想,我需要使用本地主机地址?我从哪里得到那个?
    • 试过了,还有 127.0.0.1/Service1.svc。根本不工作。
    • 我在服务器监控应用中找到了服务器的IP并解决了问题。
    【解决方案2】:

    将关闭更改为关闭 - 模式仅接受 On|Off|RemoteOnly

    【讨论】:

    • 那是拼图的一部分!
    【解决方案3】:

    云服务项目存在一个常见问题,VM 上未安装引用的 DLL。

    在您的项目引用中,您能否将所有引用配置为“复制本地”属性设置为“TRUE”,然后重新部署到 Azure?

    【讨论】:

      猜你喜欢
      • 2019-07-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多