1

我目前正在尝试针对 WSDL 编写一个小的 WCF-Routing 应用程序。但是当我尝试访问 SVC 文件时,出现以下错误:

合同需要 Session,但 Binding 'BasicHttpBinding' 不支持它或未正确配置以支持它。

由于我使用的是 SOAP12 的自定义绑定,因此我不理解此错误消息。我已经在这里搜索过了,但唯一的其他相关线程只有一条对我没有帮助的评论。(https://stackoverflow.com/questions/9896593/wcf-4-routing-service-and-configuration-error

我的 web.config 如下:

<?xml version="1.0"?>

<configuration>
    <appSettings/>
    <connectionStrings/>
    <system.web>
        <compilation debug="false" targetFramework="4.0">
        </compilation>
        <authentication mode="Windows"/>
        <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web>
    <system.serviceModel>

        <services>
            <service name="RoutingService" behaviorConfiguration="RoutingServiceBehavior">
                <host>
                    <baseAddresses>
                        <add baseAddress="http://localhost/FrontendSoap/Routingservice.svc"/>
                    </baseAddresses>
                </host>
                <endpoint name="RequestReplyBinding" binding="customBinding" bindingConfiguration="AnfragenBulk" contract="System.ServiceModel.Routing.IRequestReplyRouter"/>
            </service>
        </services>
        <behaviors>
            <serviceBehaviors>
                <behavior name="RoutingServiceBehavior">
                    <serviceMetadata httpsGetEnabled="True"/>
                    <routing filterTableName="routingFilterTable"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>

        <client>
            <endpoint name="VerfuegbarkeitAnfragenBulkPort" address="http://localhost/BackendSoap/BackendBulkService.svc" binding="customBinding" bindingConfiguration="AnfragenBulk" contract="VerfuegbarkeitAnfragenBulkService.VerfuegbarkeitAnfragenBulk"/>
        </client>
        <routing>
            <filters>
                <filter name="WebIFFilter" filterType="EndpointName" filterData="RequestReplyBinding"/>
            </filters>
            <filterTables>
                <filterTable name="routingFilterTable">
                    <add filterName="WebIFFilter" endpointName="VerfuegbarkeitAnfragenBulkPort"/>
                </filterTable>
            </filterTables>
        </routing>

        <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
        <bindings>
      <customBinding>
        <binding name="AnfragenBulk">
          <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
              messageVersion="Soap12" writeEncoding="utf-8">
            <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          </textMessageEncoding>
          <httpTransport manualAddressing="false" maxBufferPoolSize="524288"
              maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous"
              bypassProxyOnLocal="true" decompressionEnabled="true" hostNameComparisonMode="StrongWildcard"
              keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous"
              realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
              useDefaultWebProxy="true" />
        </binding>
      </customBinding>
        </bindings>
    </system.serviceModel>
</configuration>

和 RoutingService.svc:

<%@ ServiceHost Language="C#" Debug="true" Service="System.ServiceModel.Routing.RoutingService, System.ServiceModel.Routing, version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>

任何帮助和想法将不胜感激。

4

0 回答 0