2010-09-15 5 views
5

Chcę używać wshttpbinding (z SSL i bez SSL) w jednej usłudze, ale to nie działa, ktoś je zaimplementował. Więc proszę, jak mogę to osiągnąć?Użyj wshttpBinding z SSL i wsHttpBinding bez SSL w jednej usłudze.

<system.serviceModel> 
<behaviors> 
    <serviceBehaviors> 
    <behavior name="CommonBehaviour"> 
     <dataContractSerializer maxItemsInObjectGraph="2147483647" /> 
     <serviceCredentials> 
     <serviceCertificate findValue="AzilenTechnology" x509FindType="FindBySubjectName" /> 
     </serviceCredentials> 
     <serviceDebug includeExceptionDetailInFaults="false" /> 
     <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" /> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 
<bindings> 
    <basicHttpBinding> 
    <binding name="basicHttpBindingConfig" closeTimeout="00:10:00" 
     openTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="2147483647" 
     maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" 
     messageEncoding="Mtom"> 
     <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" 
     maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> 
    </binding> 
    </basicHttpBinding> 
    <wsHttpBinding> 
    <binding name="wsHttpBindingConfig" closeTimeout="00:10:00" openTimeout="00:10:00" 
     sendTimeout="00:10:00" bypassProxyOnLocal="true" maxBufferPoolSize="2147483647" 
     maxReceivedMessageSize="2147483647" messageEncoding="Mtom"> 
     <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" 
     maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> 
     <security mode="None" /> 
    </binding> 
    </wsHttpBinding> 
</bindings> 
<services> 
    <service behaviorConfiguration="CommonBehaviour" name="wcfAllInOne.wcfFileIO"> 
    <endpoint binding="mexHttpBinding" bindingConfiguration="" contract="IMetadataExchange" /> 
    <endpoint address="http://localhost:82/WCFAllInOne/wcfFileIO.svc/basicHttpEndPoint" binding="basicHttpBinding" 
     bindingConfiguration="basicHttpBindingConfig" name="BasicHttp" 
     contract="wcfAllInOne.IwcfFileIO" /> 
    <endpoint address="http://localhost:82/WCFAllInOne/wcfFileIO.svc/wsHttpBindingEndPoint" binding="wsHttpBinding" 
     bindingConfiguration="wsHttpBindingConfig" name="wsHttp" contract="wcfAllInOne.IwcfFileIO" /> 
    <endpoint address="https://localhost:444/WCFAllInOne/wcfFileIO.svc/wsHttpSslEndPoint" binding="wsHttpBinding" 
     bindingConfiguration="wsHttpBindingConfig" name="wsHttpSsl" 
     contract="wcfAllInOne.IwcfFileIO" /> 
    <endpoint binding="mexHttpsBinding" bindingConfiguration="" contract="IMetadataExchange" /> 
     </service> 
</services> 

+0

Pokaż nam, która konfiguracja nie działa. –

Odpowiedz

9

znalazłem rozwiązanie, dlaczego moja ostatnia konfiguracja nie działa,

Moim pierwszym błędem jest to, że użyłem tej samej konfiguracji dla wsHttpBinding z SSL i wsHttpBinding Bez SSL

Tutaj w moim pliku konfiguracyjnym właśnie utworzyłem tylko jeden "wsHttpBindingConfig" dla obu punktów końcowych (jeden ma adres http, a drugi ma adres https),

Teraz używam dwóch różnych konfiguracji, aby rozwiązać ten problem.

<system.serviceModel> 
<behaviors> 
    <serviceBehaviors> 
    <behavior name="CommonBehaviour"> 
     <dataContractSerializer maxItemsInObjectGraph="2147483647" /> 
     <serviceCredentials> 
     <serviceCertificate findValue="AzilenTechnologies" x509FindType="FindBySubjectName" /> 
     </serviceCredentials> 
     <serviceDebug includeExceptionDetailInFaults="false" /> 
     <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" /> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 
<bindings> 
    <basicHttpBinding> 
    <binding name="basicHttpBindingConfig" closeTimeout="00:10:00" 
     openTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="2147483647" 
     maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" 
     messageEncoding="Mtom"> 
     <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" 
     maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> 
     <security> 
     <transport> 
      <extendedProtectionPolicy policyEnforcement="Never" /> 
     </transport> 
     </security> 
    </binding> 
    </basicHttpBinding> 
    <wsHttpBinding> 
    <binding name="wsHttpsBindingConfig" closeTimeout="00:10:00" 
     openTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="true" 
     maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" 
     messageEncoding="Mtom"> 
     <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" 
     maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> 
     <security mode="Transport"> 
     <transport clientCredentialType="None"> 
      <extendedProtectionPolicy policyEnforcement="Never" /> 
     </transport> 
     </security> 
    </binding> 
    <binding name="wsHttpBindingConfig" closeTimeout="00:10:00" openTimeout="00:10:00" 
     sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" 
     messageEncoding="Mtom"> 
     <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" 
     maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> 
     <security> 
     <transport> 
      <extendedProtectionPolicy policyEnforcement="Never" /> 
     </transport> 
     </security> 
    </binding> 
    </wsHttpBinding> 
</bindings> 
<services> 
    <service behaviorConfiguration="CommonBehaviour" name="wcfAllInOne.wcfFileIO"> 
    <endpoint binding="mexHttpBinding" bindingConfiguration="" contract="IMetadataExchange" /> 
    <endpoint address="/basicHTTPEndPoint" binding="basicHttpBinding" 
     bindingConfiguration="basicHttpBindingConfig" name="basicHttp" 
     contract="wcfAllInOne.IwcfFileIO" /> 
    <endpoint address="/wsHTTPEndPoint" binding="wsHttpBinding" bindingConfiguration="wsHttpBindingConfig" 
     name="wsHttp" contract="wcfAllInOne.IwcfFileIO" /> 
    <endpoint address="/wsHTTPSEndPoint" binding="wsHttpBinding" 
     bindingConfiguration="wsHttpsBindingConfig" name="wsHttpSsl" 
     contract="wcfAllInOne.IwcfFileIO" /> 
    <endpoint binding="mexHttpsBinding" bindingConfiguration="" contract="IMetadataExchange" /> 
    </service> 
</services> 

+0

, więc ta konfiguracja działa ,, –

+0

Mam nadzieję, że możemy użyć WSHttpBinding 'bez SSL && https: //' right? –

+0

@murali Tak, to działa –