我正在尝试为VS2015项目添加服务引用。该服务发布在Azure VM中托管的Windows Server 2012中的IIS上。这是我第一次在Azure VM(Windows Server 2012)中托管服务,所以我不知道我可能做错了什么。
我可以正常访问我的网页浏览器中的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>
答案 0 :(得分:0)
看起来您尚未发布服务的元数据,请尝试:
<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>
答案 1 :(得分:0)
我通过在web.config转换文件中设置此属性解决了我的问题:
input.validity