【问题标题】:WCF published to Azure Cloud Service is unreachable发布到 Azure 云服务的 WCF 无法访问
【发布时间】:2015-04-08 07:35:15
【问题描述】:

当我在我的计算机上运行 WCF 时,它按预期工作,但是当我发布它(来自 VS 2013)时,我无法访问它。

当我尝试时:

http://myWCF.cloudapp.net/Service.svc

http://myWCF.cloudapp.net

我明白了

No HTTP resource was found that matches the request URI

这是我的 web.config 文件:

    <?xml version="1.0"?>
<configuration>
  <connectionStrings>
    <add name="Storage" connectionString="DefaultEndpointsProtocol" />
    <add name="DB" connectionString="Server=tcplient" />
  </connectionStrings>
  <system.diagnostics>
    <trace>
      <listeners>
        <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
          name="AzureDiagnostics">
          <filter type="" />
        </add>
      </listeners>
    </trace>
  </system.diagnostics>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
  </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="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="false"
      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>

也许是预先配置的远程桌面出了问题?

知道为什么会这样吗?是什么原因造成的?

更新

按预期发布其作品后(很好),但在我使用远程桌面连接连接到服务并在机器上安装我的软件后,我得到了

没有 HTTP 资源...

附加信息:

这是 csdef 文件:(带有端点)

    <ServiceDefinition name="FilteringServiceAzureWCF" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2014-06.2.4">
  <WebRole name="WCFFilteringService" vmsize="Small">
    <Runtime executionContext="elevated" />
    <Sites>
      <Site name="Web">
        <Bindings>
          <Binding name="Endpoint1" endpointName="Endpoint1" />
        </Bindings>
      </Site>
    </Sites>
    <Endpoints>
      <InputEndpoint name="Endpoint1" protocol="http" port="80" />
    </Endpoints>
    <ConfigurationSettings>
    </ConfigurationSettings>
    <Imports>
      <Import moduleName="RemoteAccess" />
      <Import moduleName="RemoteForwarder" />
    </Imports>
  </WebRole>
</ServiceDefinition>

【问题讨论】:

  • 您是否检查了端口 80 的端点是否已为 VM 或云服务打开?
  • 我更新了我原来的帖子@SimonW。
  • 我建议您将 WCF 服务托管在辅助角色云服务中,通过手动配置,您一定可以访问您的服务

标签: c# wcf azure azure-cloud-services


【解决方案1】:

确保您的 80 端口没有被您机器上的任何其他程序占用。

WCF 默认使用端口 80,但是您可以在 csdef 文件中定义不同的端口。

【讨论】:

    猜你喜欢
    • 2012-05-21
    • 2014-10-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多