1

IIS7とセルフホストの両方でホストするWCFサービスがあり、デフォルトのセルライザーを使用すると、両方でうまく機能します。

protobuf.netエンドポイントを実行すると、IIS7ホストに対してはうまく機能しますが、セルフホストに対して実行すると、最初のサービスメソッドへの要求としてnullを取得しますか?

どこを見ればいいですか?この問題を解決するために何が必要ですか?

よろしくお願いします

Edit1:App.config(セルフホスト)

    <system.serviceModel>
  <diagnostics>
    <messageLogging logEntireMessage="true" logMalformedMessages="true"
      logMessagesAtTransportLevel="true" />
  </diagnostics>
  <extensions>
    <behaviorExtensions>
      <add name="protobuf" type="ProtoBuf.ServiceModel.ProtoBehaviorExtension, protobuf-net, Version=2.0.0.480, Culture=neutral, PublicKeyToken=257b51d87d2e4d67"/>
      <add name="customBehaviorExtension_Integration" type="MyApp.ServiceImplementation.CustomRequestInterceptorBehaviorExtension_Integration, MyApp.ServiceImplementation"/>
      <add name="customBehaviorExtension_ClientService" type="MyApp.ServiceImplementation.CustomRequestInterceptorBehaviorExtension_ClientService, MyApp.ServiceImplementation"/>
    </behaviorExtensions>
  </extensions>
  <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
  <behaviors>
    <serviceBehaviors>
      <behavior name="MyApp.ServiceImplementation.MyAppIntegration_Behavior">
        <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        <serviceDebug includeExceptionDetailInFaults="true"/>
        <serviceMetadata httpGetEnabled="true"/>
        <customBehaviorExtension_Integration/>
      </behavior>
      <behavior name="MyAppClientService.CustomValidator_Behavior">
        <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        <serviceDebug includeExceptionDetailInFaults="true"/>
        <serviceMetadata httpGetEnabled="true"/>
        <customBehaviorExtension_ClientService/>
        <serviceThrottling maxConcurrentCalls="2000" maxConcurrentSessions="2147483647" maxConcurrentInstances="2000"/>
        <serviceCredentials>
          <clientCertificate>
            <authentication certificateValidationMode="PeerOrChainTrust"/>
          </clientCertificate>
          <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="MyApp.ServiceImplementation.CustomUsernamePasswordValidator, MyApp.ServiceImplementation"/>
        </serviceCredentials>
        <serviceAuthorization principalPermissionMode="Custom" serviceAuthorizationManagerType="MyApp.ServiceImplementation.CustomServiceAuthorizationManager, MyApp.ServiceImplementation">
          <authorizationPolicies>
            <add policyType="MyApp.ServiceImplementation.CustomAuthorizationPolicy_ClientService, MyApp.ServiceImplementation"/>
          </authorizationPolicies>
        </serviceAuthorization>
      </behavior>
      <behavior name="MyApp.ServiceImplementation.HL7Service_Behavior">
        <serviceDebug includeExceptionDetailInFaults="true"/>
        <serviceMetadata httpGetEnabled="true" externalMetadataLocation="..\Schema\HL7\DIPS\IHl7Service.wsdl"/>
        <customBehaviorExtension_Integration/>
      </behavior>
    </serviceBehaviors>
    <endpointBehaviors>
      <behavior name="protoEndpointBehavior">
        <protobuf/>
      </behavior>
    </endpointBehaviors>
  </behaviors>
  <services>
    <service behaviorConfiguration="MyApp.ServiceImplementation.MyAppIntegration_Behavior" name="MyApp.ServiceImplementation.MyAppIntegration">
      <endpoint binding="basicHttpBinding" bindingConfiguration="BasicMyAppIntegration" bindingNamespace="MyApp.ServiceImplementation" contract="MyApp.ServiceContracts.IMyAppIntegration"/>
      <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      <host>
        <baseAddresses>
          <add baseAddress="http://localhost:8003/MyApp5Service/Integration"/>
        </baseAddresses>
      </host>
    </service>
    <service behaviorConfiguration="MyAppClientService.CustomValidator_Behavior" name="MyApp.ServiceImplementation.MyAppClientService">
      <endpoint binding="netTcpBinding" bindingConfiguration="netTcpRegular" address="Regular" bindingNamespace="http://MyApp.ServiceContracts/2007/11" contract="MyApp.ServiceContracts.IMyAppClientService"/>
      <endpoint binding="netTcpBinding" behaviorConfiguration="protoEndpointBehavior" bindingConfiguration="netTcpRegular" address="Proto" bindingNamespace="http://MyApp.ServiceContracts/2007/11" contract="MyApp.ServiceContracts.IMyAppClientService"/>

      <endpoint binding="netTcpBinding" bindingConfiguration="netTcpWindowMessageSecurity" address="Windows" bindingNamespace="http://MyApp.ServiceContracts/2007/11" contract="MyApp.ServiceContracts.IMyAppClientService"/>
      <host>
        <baseAddresses>
          <add baseAddress="net.tcp://localhost:8001/MyApp5Service/Client/"/>
          <add baseAddress="http://localhost:8002/MyApp5Service/Client"/>
        </baseAddresses>
      </host>
    </service>
    <service behaviorConfiguration="MyApp.ServiceImplementation.HL7Service_Behavior" name="MyApp.ServiceImplementation.HL7Service">
      <endpoint binding="basicHttpBinding" bindingConfiguration="BasicBindingHL7" contract="IHL7Service"/>
      <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      <host>
        <baseAddresses>
          <add baseAddress="http://localhost:8004/MyApp5Service/Hl7"/>
        </baseAddresses>
      </host>
    </service>
  </services>
  <bindings>
    <netTcpBinding>
      <binding name="netTcpCertificate" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="infinite" sendTimeout="01:00:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="1000" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="200" maxReceivedMessageSize="2147483647">
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
        <reliableSession ordered="true" inactivityTimeout="infinite" enabled="false"/>
        <security mode="TransportWithMessageCredential">
          <transport clientCredentialType="Certificate"/>
          <message clientCredentialType="UserName"/>
        </security>
      </binding>
      <binding name="netTcpWindowMessageSecurity" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="infinite" sendTimeout="01:00:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="1000" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="200" maxReceivedMessageSize="2147483647">
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
        <reliableSession ordered="true" inactivityTimeout="infinite" enabled="false"/>
        <security mode="Message">
          <message clientCredentialType="Windows"/>
        </security>
      </binding>
      <!---->
      <binding name="netTcpRegular" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="infinite" sendTimeout="01:00:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="1000" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="200" maxReceivedMessageSize="2147483647">
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
        <reliableSession ordered="true" inactivityTimeout="infinite" enabled="false"/>
        <security mode="None">
          <transport clientCredentialType="None"/>
        </security>
      </binding>
    </netTcpBinding>
    <customBinding>
      <binding name="UsernamePasswordOverHttp">
        <textMessageEncoding messageVersion="Soap11"/>
        <security authenticationMode="UserNameOverTransport" messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10" allowInsecureTransport="true"/>
        <httpsTransport/>
      </binding>
    </customBinding>
    <basicHttpBinding>
      <binding name="BasicMyAppIntegration" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="infinite" sendTimeout="01:00:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
        <security mode="None"/>
      </binding>
      <binding name="BasicBindingHL7" allowCookies="true" closeTimeout="04:00:00" openTimeout="04:00:00" receiveTimeout="04:00:00" sendTimeout="04:00:00" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">

        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
        <security mode="None">
          <transport clientCredentialType="None"/>
        </security>
      </binding>
    </basicHttpBinding>
  </bindings>
</system.serviceModel>
4

1 に答える 1

2

クライアントでの単純な構成snafuのように見えます(これは個別に送信されました)。(クライアント構成でまったく)使用されていない興味深いものの1つは、次のprotoEndpointBehaviorように定義されたもの<endpointBehaviors>です。

<endpoint
  address="...(omitted).../Proto"
  behaviorConfiguration="BasicBehavior"
  ...(omitted)...
  name="SelfHostProto_RegularLogin"/>

これをに変更するBasicBehaviorprotoEndpointBehaviorすべてが機能します。メッセージは正しく送受信されます。

于 2012-08-30T07:25:07.780 に答える