有谁知道如何配置要从Azure功能调用的WCF服务?
情景:
但每当我从我得到的功能中调用它时:
无法找到名称为' ABC'的端点元素和合同' ABC'在ServiceModel客户端配置部分中。这可能是因为没有为您的应用程序找到配置文件,或者因为在客户端元素中找不到与此名称匹配的端点元素。
服务配置:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="TranslationBridgeWebServiceSoap" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" useDefaultWebProxy="true">
<security mode="None" />
</binding>
</basicHttpBinding>
<customBinding>
<binding name="TranslationBridgeWebServiceSoap12" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00">
<textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" messageVersion="Soap12WSAddressingAugust2004" writeEncoding="utf-8">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</textMessageEncoding>
<security authenticationMode="UserNameOverTransport" allowInsecureTransport="false" />
<httpsTransport manualAddressing="false" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous" bypassProxyOnLocal="false" decompressionEnabled="true" hostNameComparisonMode="StrongWildcard" keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous" realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="https://abc/TranslationBridgeExternalService.asmx" binding="customBinding" bindingConfiguration="TranslationBridgeWebServiceSoap12" contract="ABC" name="ABC" />
<endpoint address="https://abc/TranslationBridgeExternalService.asmx" binding="basicHttpBinding" bindingConfiguration="TranslationBridgeWebServiceSoap" contract="ABC" name="ABC" />
</client>
感谢您的帮助。
答案 0 :(得分:1)
Azure功能应用程序没有web.config
文件(如果您手动设置它将被忽略)。
因此,您必须通过在代码中配置来创建WCF客户端。实际上,在代码中实例化所有绑定,端点等。对于每个WCF类,总是有一个构造函数来实例化一个没有配置文件的所有参数的实体。