繁体   English   中英

无法将Azure VM上托管的WCF服务引用添加到VS2015项目

[英]Can't add WCF service reference hosted on Azure VM to VS2015 project

我正在尝试向我的VS2015项目添加服务引用。 该服务在Azure VM托管的Windows Server 2012中的IIS上发布。 这是我第一次在Azure VM(Windows Server 2012)中托管服务,因此我不知道自己可能做错了什么。

我可以正常在Web浏览器中访问TheService.svc文件(即: http://xxxxxx.xxxxx.cloudapp.azure.com/TheService/TheService.svc : http://xxxxxx.xxxxx.cloudapp.azure.com/TheService/TheService.svc )。

但是,当我尝试在VS项目中使用相同的地址添加服务引用时,它只是挂在: Please wait for service information to be downloaded or click Stop并且从不下载元数据。

这是web.config中的服务配置:

<system.serviceModel>
    <diagnostics>
      <messageLogging logMalformedMessages="true" logMessagesAtTransportLevel="true" />
    </diagnostics>
    <bindings>
      <basicHttpBinding>
        <binding name="TestBinding" closeTimeout="00:10:00" openTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="true" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Streamed" messageEncoding="Text">
          <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service name="TheService.TheService">
        <endpoint address="http://localhost/TheService/TheService.svc" binding="basicHttpBinding" bindingConfiguration="TestBinding" name="TheService_Local" contract="TheService.ITheService" />
        <host>
          <timeouts openTimeout="00:10:00" />
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="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>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
  </system.serviceModel>

您似乎尚未发布该服务的元数据,请尝试:

 <service name="TheService.TheService">
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="TestBinding" name="TheService_Local" contract="TheService.ITheService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    <host>
      <timeouts openTimeout="00:10:00" />
    </host>
  </service>

我通过在web.config转换文件中设置此属性来解决我的问题:

<serviceHostingEnvironment multipleSiteBindingsEnabled="true" xdt:Transform="SetAttributes(multipleSiteBindingsEnabled)"/>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM