如何把system.serviceModel到ServiceConfiguration.cscfg(Windows Azure的) [英] How to put system.serviceModel into ServiceConfiguration.cscfg (Windows Azure)

查看:182
本文介绍了如何把system.serviceModel到ServiceConfiguration.cscfg(Windows Azure的)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下code(适用于Microsoft译者)

I have following code (for Microsoft Translator)

    <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工作者角色,所以我得到了错误找不到引用合同'TranslatorService.LanguageService在ServiceModel客户端配置节的默认终结点元素。这可能是因为没有配置文件,发现你的应用程序,或者是因为匹配这份合同没有终结点元素可以在客户端的元素被发现。

It was in web.config and working well. Now I need to put some translate function to Azure Worker Role, so I got error 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 ,但如何?我尝试过很多位置,但所有的错误,无法部署。请帮助

I already found solution is to put above settings to ServiceConfiguration.cscfg, but how? I tried many location but all error and cannot deploy. Please help

推荐答案

的<一个href=\"http://msdn.microsoft.com/en-us/library/windowsazure/ee758710.aspx\">ServiceConfiguration.cscfg只能包含天青具体结构(如实例数,配置设置,指纹,...)。

The ServiceConfiguration.cscfg can only contain Azure specific configuration (like number of instances, configuration settings, thumbprints, ...).

当你需要做定期的.NET配置(如WCF例如),你可以简单地创建一个的app.config 作为您的辅助角色,如果你会为一个控制台应用程序,并把你的配置中这里。需要注意的是,如果你想将其添加在App.config在你的问题样本配置不完整。你应该把这个包周围:

Whenever you need to do regular .NET configuration (like WCF for example) you can simply create an app.config for your worker role as if you would for a console application and put your configuration in here. Note that the sample configuration in your question isn't complete if you want to add it in the app.config. You should wrap this around it:

<?xml version="1.0"?>
<configuration>

  ...

</configuration>

这篇关于如何把system.serviceModel到ServiceConfiguration.cscfg(Windows Azure的)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆