gpt4 book ai didi

wcf - 无法在 Azure 上使用 wsHttpBinding 添加对服务的引用

转载 作者:行者123 更新时间:2023-12-03 00:34:01 24 4
gpt4 key购买 nike

我刚刚发布了一个使用 wsHttpBinding 到 Azure 的 WCF 服务。在开发环境中,我添加了服务引用,效果很好,但是部署到Azure后,服务引用没有生成代理类。我必须切换到 Web 引用才能使代码生成正常工作。为什么?

这是我的配置文件:

    <?xml version="1.0"?>
<configuration>
<system.diagnostics>
<trace>
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="AzureDiagnostics">
<filter type="" />
</add>
</listeners>
</trace>
</system.diagnostics>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="MyService.DataSync">
<host>
<baseAddresses>
<add baseAddress="http://localhost:57059"/>
<add baseAddress="http://xxxxxxxxxxx.cloudapp.net"/>
</baseAddresses>
</host>
<endpoint address=""
binding="wsHttpBinding" bindingConfiguration="" name="SvcEndpoint"
contract="MyLibrary.IDataSync" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
<connectionStrings>
<add name="db" connectionString="...."/>
</connectionStrings>
</configuration>

谢谢。

最佳答案

将此行为配置添加到您的端点

<behavior name="web"
<webHttp />
</behavior>

关于wcf - 无法在 Azure 上使用 wsHttpBinding 添加对服务的引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13554713/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com