2013-08-07 9 views
5

Ich habe einen WCF-Dienst, der mit basicHttpBinding funktioniert, ich versuche, es über HTTPS zu gehen und authentifizieren mit einem SQL-Mitgliedschaft-Provider, und ich versuche, es zu konvertieren, um wsHttpBinding zu verwenden .Konfigurieren von WCF für wsHttpBinding

jedoch mit den aktualisierten Konfigurations bekomme ich folgende Fehlermeldung, wenn ich versuche, mit dem Kunden zu verbinden:

kann nicht Standard Endpunktelement finden, dass Verweise Vertrag ‚KFileService.IKFileWcfService‘ im Servicemodel-Client-Konfiguration Abschnitt . Dies liegt möglicherweise daran, dass keine Konfigurationsdatei für Ihre Anwendung gefunden wurde oder dass kein Endpunktelement gefunden wurde, das diesem Vertrag entspricht.

Hier ist der relevante Teil der web.config für den Server:

<system.serviceModel> 
    <protocolMapping> 
     <remove scheme="http" /> 
     <add scheme="https" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_IKFileWcfServiceBinding" /> 
    </protocolMapping> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="KFileWcfServiceBehavior"> 
      <serviceMetadata httpGetEnabled="true" /> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
      <dataContractSerializer maxItemsInObjectGraph="2147483646" /> 
      <serviceCredentials> 
      <userNameAuthentication userNamePasswordValidationMode="MembershipProvider" 
       membershipProviderName="SqlMembershipProvider" /> 
      </serviceCredentials> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <services> 
     <service behaviorConfiguration="KFileWcfServiceBehavior" name="KFileWcfService"> 
     <endpoint address="https://localhost:36492/KFileWcfService.svc" 
      binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_IKFileWcfServiceBinding" 
      name="wsHttpBinding_IKFileWcfService" bindingName="wsHttpBinding_IKFileWcfServiceBinding" 
      contract="KFileWcfService.IKFileWcfService"> 
      <identity> 
      <certificateReference storeLocation="CurrentUser" /> 
      </identity> 
     </endpoint> 
     </service> 
    </services> 
    <serviceHostingEnvironment minFreeMemoryPercentageToActivateService="0" multipleSiteBindingsEnabled="true"/> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="wsHttpBinding_IKFileWcfServiceBinding" maxBufferPoolSize="2147483647" 
      maxReceivedMessageSize="2147483647"> 
      <readerQuotas maxDepth="32" maxStringContentLength="100000" maxArrayLength="2147483647" 
      maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
      <security mode="Message"> 
      </security> 
     </binding> 
     </wsHttpBinding> 
    </bindings> 
</system.serviceModel> 

Und hier ist der Client-Seite:

<system.serviceModel> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="wsHttpBinding_IKFileWcfService" /> 
     </wsHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="https://localhost:36492/KFileWcfService.svc" 
     binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_IKFileWcfService" 
     contract="KFileWcfService.IKFileWcfService" name="wsHttpBinding_IKFileWcfService" /> 
    </client> 
    </system.serviceModel> 

ich mein Bestes getan habe, alle gehen durch die bestehende Fragen und Beispiele bereits, hatten aber kein Glück. Kann mir jemand sagen, was ich falsch mache?

Edit:

Für weitere Referenz, hier ist die serverseitige Konfiguration, die mit Basichttpbinding funktioniert:

<system.serviceModel> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior> 
      <!-- To avoid disclosing metadata information, set the value below to false before deployment --> 
      <serviceMetadata httpGetEnabled="true" /> 
      <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
      <dataContractSerializer maxItemsInObjectGraph="2147483646" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <services> 
     <service name="KFileWcfService"> 
     <endpoint address="https://localhost:36492/KFileWcfService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IKFileWcfService" contract="KFileService.IKFileWcfService" name="BasicHttpBinding_IKFileWcfService" /> 
     </service> 
    </services> 
    <serviceHostingEnvironment minFreeMemoryPercentageToActivateService="0" multipleSiteBindingsEnabled="true"/> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="BasicHttpBinding_IKFileWcfService" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Streamed"> 
      <readerQuotas maxDepth="32" maxStringContentLength="100000" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
</system.serviceModel> 

und Client:

<system.serviceModel> 
     <bindings> 
      <basicHttpBinding> 
       <binding name="BasicHttpBinding_IKFileWcfService" /> 
      </basicHttpBinding> 
     </bindings> 
     <client> 
      <endpoint address="https://localhost:36492/KFileWcfService.svc" 
       binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IKFileWcfService" 
       contract="KFileService.IKFileWcfService" name="BasicHttpBinding_IKFileWcfService" /> 
     </client> 
    </system.serviceModel> 
+0

vielleicht zeigen Sie Ihre ältere basicHttpBindend zu uns. –

+0

Hinzugefügt zu der Frage. – Eric

Antwort

6

Die Art des Servicevertrages auf dem Client die Sie versuchen zu verwenden, basierend auf Ihrem Fehler messages:

KFileService.IKFileWcfService 

Die Art der Servicevertrags-Schnittstelle, die Sie auf Ihrer Client-Konfiguration haben:

KFileWcfService.IKFileWcfService 

sollten Sie das gleiche sein. Ändern Sie die Client-Konfiguration in

... contract="KFileService.IKFileWcfService" ... 

Und es sollte funktionieren.

+2

Guten alten stackoverflow. Über der Schulter Unterstützung für Tippfehler. Schöne Abholung. –

+0

Ja, danke! Ich weiß nicht, wie lange ich es noch angestarrt hätte, bevor ich es selbst bemerkt habe. Es sieht so aus, als gäbe es immer noch ein paar Probleme mit der Konfiguration, aber das hat den Fehler in der Frage gelöst, also markiere ich das als akzeptierte Antwort. Danke noch einmal! – Eric

Verwandte Themen