IIS 7中托管的WCF服务-绑定配置设置将被忽略 [英] WCF service hosted in IIS 7 - binding configuration settings are ignored

查看:136
本文介绍了IIS 7中托管的WCF服务-绑定配置设置将被忽略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WCF服务操作,该操作接受一个字节数组作为其数据协定的一部分.该服务仅在内部公开(不向Internet公开),我想增加配额以允许10MB字节数组.

I have a WCF service operation that accepts a byte array as part of its data contract. The service is only exposed internally (not to the internet), and I want to increase the quotas to allow for a 10MB byte array.

该服务托管在IIS7中.当我尝试发送默认长度以上的字节数组时,收到以下异常消息:

The service is hosted in IIS7. When I try to send a byte array over the default length, I get the following exception message:

反序列化类型的对象时出错 MyService.ServiceContracts.Data.最大数组长度配额 读取XML数据时已超过(16384).此配额可能是 通过更改 创建XML阅读器时使用的XmlDictionaryReaderQuotas对象. 第1行,位置22991.

There was an error deserializing the object of type MyService.ServiceContracts.Data. The maximum array length quota (16384) has been exceeded while reading XML data. This quota may be increased by changing the MaxArrayLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 22991.

这是配置:

<system.serviceModel>
    <netTcpBinding>
        <binding name="largeBinaryBinding" maxReceivedMessageSize="10001000" 
                 maxBufferPoolSize="80008000" maxBufferSize="10001000"
                 receiveTimeout="00:01:00" openTimeout="00:01:00" 
                 closeTimeout="00:01:00" sendTimeout="00:01:00">
            <readerQuotas maxArrayLength="10000000" />
        </binding>
    </netTcpBinding>

    <services>
        <service name="MyService">
            <endpoint binding="netTcpBinding"
                      bindingConfiguration="largeBinaryBinding"
                      bindingNamespace="http://my.services.co.uk/MyService"
                      contract="Services.MyService.ServiceContracts.IMyService" />
        </service>
    </services>
</system.serviceModel>

因此,我的配置允许较大的邮件,但是IIS似乎忽略了这一点-如何停止它并允许较大的邮件通过?

So my configuration allows for larger messages, but IIS seems to be ignoring this - how do I stop this and allow large messages through?

推荐答案

再次,在我发布问题之后,我便找到了答案!

Again, just after I post a question I discover the answer!

使用WAS时,需要在配置的服务名称中指定服务的完整类名称.因此,在我的示例中,我在名称空间Services中有一个名为MyService的服务实现类.因此,在配置中,我需要

When using WAS, you need to specify the full class name of the service in the configuration's service name. So in my example, I had my service implementation class called MyService, in the namespace Services. Therefore, in the configuration, I need

<service name="Services.MyService">
   ...

否则,IIS会默默地忽略您精心设计的配置!多么方便.

Otherwise IIS silently ignores your carefully crafted configuration! How convenient.

这篇关于IIS 7中托管的WCF服务-绑定配置设置将被忽略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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