【发布时间】: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。本地主机不适合我。
【问题讨论】: