Laden...

Exception bzgl. MessageSize Eigenschaft

Erstellt von DavidT vor 13 Jahren Letzter Beitrag vor 13 Jahren 1.395 Views
DavidT Themenstarter:in
998 Beiträge seit 2007
vor 13 Jahren
Exception bzgl. MessageSize Eigenschaft

Hallo,

ich biete größere Bilder (~300kb) per WCF Service an mit folgender Konifguration:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="basicHttpBindingWithMtom" maxBufferSize="1048576"
                maxBufferPoolSize="1048576" maxReceivedMessageSize="1048576"
                messageEncoding="Mtom" />
        </basicHttpBinding>
        <netTcpBinding>
            <binding name="netTcpBindingForLargeMessages" maxBufferPoolSize="1048576"
                maxBufferSize="1048576" maxReceivedMessageSize="1048576">
                <readerQuotas maxArrayLength="1048576" maxBytesPerRead="1048576" />
            </binding>
        </netTcpBinding>
    </bindings>
    <behaviors>
        <serviceBehaviors>
            <behavior name="LiveProxyBehavior">
                <serviceMetadata httpGetEnabled="true" httpGetUrl="" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <services>
        <service behaviorConfiguration="LiveProxyBehavior" name="WINSTON.Record.Recorder.LiveProxy.LiveProxyService">
            <endpoint address="" behaviorConfiguration="" binding="basicHttpBinding"
                bindingConfiguration="basicHttpBindingWithMtom" name="HttpEndpoint"
                contract="ILiveViewContract" />
            <endpoint binding="netTcpBinding" bindingConfiguration="netTcpBindingForLargeMessages"
                name="TcpEndpoint" contract="ILiveViewContract" />
            <host>
                <baseAddresses>
                    <add baseAddress="http://localhost:6515/LiveProxy/DavidBuero" />
                    <add baseAddress="net.tcp://localhost:6516/LiveProxy/DavidBuero" />
                </baseAddresses>
            </host>
        </service>
    </services>
  </system.serviceModel>

Also die MessageSize-Eigenschaft ist für beide Bindings auf ca. 1MB festgelegt. Aber irgendwie wird das beim erstellen des Services einfach ignoriert und taucht nicht in der WSDL-Beschreibung auf und dementsprechend auch nicht in der config wenn ich es mit dem WcfTestClient teste:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="HttpEndpoint" 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="Mtom" 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>
            <netTcpBinding>
                <binding name="TcpEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00"
                    receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false"
                    transferMode="Buffered" transactionProtocol="OleTransactions"
                    hostNameComparisonMode="StrongWildcard" listenBacklog="10"
                    maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
                    maxReceivedMessageSize="65536">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <reliableSession ordered="true" inactivityTimeout="00:10:00"
                        enabled="false" />
                    <security mode="Transport">
                        <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
                        <message clientCredentialType="Windows" />
                    </security>
                </binding>
            </netTcpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:6515/LiveProxy/DavidBuero"
                binding="basicHttpBinding" bindingConfiguration="HttpEndpoint"
                contract="ILiveViewContract" name="HttpEndpoint" />
            <endpoint address="net.tcp://localhost:6516/LiveProxy/DavidBuero"
                binding="netTcpBinding" bindingConfiguration="TcpEndpoint"
                contract="ILiveViewContract" name="TcpEndpoint">
                <identity>
                    <userPrincipalName value="XXX" />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>
</configuration>

Was ist das Problem? Funktioniert es nicht wenn ich 2 Bindings eine Konfiguration mitgebe?

Gruß David

W
955 Beiträge seit 2010
vor 13 Jahren

Hi

ich bin mir nicht sicher ob ich Dich richtig verstanden habe. Aber Du solltest in beiden Konfigurationen (Service und Client) diese Einstellungen selbst vornehmen, die Throttling-Eigenschaften (maxReceivedMessageSize, ...) sind keine "verlinkten Kopien" sondern getrennte Eigenschaften für Client und Service.

DavidT Themenstarter:in
998 Beiträge seit 2007
vor 13 Jahren

Hallo,

ich bin gestern dann auch darauf gekommen, das diese Metadaten ja gar nicht per WSDL publiziert werden und somit auch nicht im Client bekannt sein können. Trotzdem vielen Dank!

Gruß David