我有以下代码(用于微软翻译)
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_LanguageService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://api.microsofttranslator.com/V2/soap.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_LanguageService" contract="TranslatorService.LanguageService" name="BasicHttpBinding_LanguageService" />
</client>
</system.serviceModel>
它是在web.config
并且工作良好。现在我需要将一些翻译功能添加到Azure Worker Role中,所以我得到了错误Could not find default endpoint element that references contract 'TranslatorService.LanguageService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
我已经找到解决方案是将以上设置放入ServiceConfiguration.cscfg
,但是如何呢?我尝试了很多位置,但都出错并且无法部署。请帮忙
The 服务配置.cscfg http://msdn.microsoft.com/en-us/library/windowsazure/ee758710.aspx只能包含 Azure 特定配置(例如实例数量、配置设置、指纹等)。
每当您需要进行常规 .NET 配置(例如 WCF)时,您只需创建一个应用程序配置对于您的辅助角色,就像您对于控制台应用程序一样,并将您的配置放在此处。请注意,如果您想将其添加到 app.config 中,问题中的示例配置并不完整。你应该把它包裹起来:
<?xml version="1.0"?>
<configuration>
...
</configuration>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)