1

我创建了一个简单的服务,只是为了在 Cent OS 中尝试 WCF。我在 Windows 中使用 MonoDevelop 创建了服务客户端,它运行良好。当我尝试在 CentO 上运行它(使用相同的配置文件)时,它会在构建客户端时引发错误,我在这里跟踪它:

                ExtensionElementCollection extensions = ((ExtensionsSection) EvaluationContext.GetSection ("system.serviceModel/extensions")).BindingExtensions;
                for (int i = 0; i < extensions.Count; i++) {
                    ExtensionElement extension = extensions [i];
                    _properties.Add (new ConfigurationProperty (extension.Name, Type.GetType (extension.Type), null, null, null, ConfigurationPropertyOptions.None));
                }

在 System.ServiceModel.Configuration.BindingsSection

错误是 ConfigurationProperty 构造函数中的 argumentNullException,类型为 null。因此,EvaluationContext.GetSection ("system.serviceModel/extensions") 中的 Type.GetType 失败了。我在配置文件中没有扩展部分,并且这个相同的客户端在 Windows 中完美运行。任何提示。

这是我的配置文件:

<configuration>
<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_IPairArithmeticService" 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://theIp/AlertService/Services/PairArithmeticService.svc"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IPairArithmeticService"
            contract="ServiceReference1.IPairArithmeticService" name="BasicHttpBinding_IPairArithmeticService" />
    </client>
</system.serviceModel>

4

0 回答 0