发布到Azure云服务的WCF无法访问

时间:2015-04-08 07:35:15

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

当我在计算机上运行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资源......

Additnial info:

这是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>

1 个答案:

答案 0 :(得分:1)

确保您的端口80未被计算机上的任何其他程序占用。

默认情况下,WCF使用端口80,但您可以在csdef文件上定义不同的端口。