2009-07-22 10 views
5

Ich bin nach dem Einrichten eines WCF-Dienstes auf meiner Dev-Box, aber ich bekomme einen Fehler beim Zugriff darauf. Ich habe die service up as per this guide eingestellt. Es ist in VS2008/C#/.NET 3.5 geschrieben und meine Dev-Box ist Vista SP2 mit IIS 7. Im Moment ist der Dienst nichts mehr als die Standardstruktur, da ich buchstäblich eine Verbindung dazu getestet habe.Problem mit WCF-Dienst - Das Protokoll 'http' wird nicht unterstützt. Wie löst man?

ich eingecheckt haben, was installiert werden muss, und ich bin ziemlich sicher, dass ich habe alles aktiviert, Screenshot zeigt unter dem aktuellen Optionen:

Windows IIS Options

Vollfehlermeldung auf http://localhost:8000/Service.svc Zugriff ist wie folgt:

Irgendwelche Vorschläge zum Debuggen/Beheben des Fehlers gehen würde dankbar erhalten. Das googlen des Fehlers gibt sehr wenig Hilfe. Ich habe wahrscheinlich etwas ganz offensichtlich übersehen!

bearbeiten - web.config wie gewünscht (für seine Länge Entschuldigungen):

<?xml version="1.0"?> 
<!-- 
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use 
    the Website->Asp.Net Configuration option in Visual Studio. 
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
    \Windows\Microsoft.Net\Framework\v2.x\Config 
--> 
<configuration> 
    <configSections> 
     <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 
      <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 
       <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
       <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 
        <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/> 
        <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
        <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
        <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
       </sectionGroup> 
      </sectionGroup> 
     </sectionGroup> 
    </configSections> 
    <appSettings/> 
    <connectionStrings/> 
    <system.web> 
     <!-- 
      Set compilation debug="true" to insert debugging 
      symbols into the compiled page. Because this 
      affects performance, set this value to true only 
      during development. 
     --> 
     <compilation debug="true"> 
      <assemblies> 
       <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> 
       <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> 
       <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
       <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> 
      </assemblies> 
     </compilation> 
     <!-- 
      The <authentication> section enables configuration 
      of the security authentication mode used by 
      ASP.NET to identify an incoming user. 
     --> 
     <authentication mode="Windows"/> 
     <!-- 
      The <customErrors> section enables configuration 
      of what to do if/when an unhandled error occurs 
      during the execution of a request. Specifically, 
      it enables developers to configure html error pages 
      to be displayed in place of a error stack trace. 

     <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> 
      <error statusCode="403" redirect="NoAccess.htm" /> 
      <error statusCode="404" redirect="FileNotFound.htm" /> 
     </customErrors> 
     --> 
     <pages> 
      <controls> 
       <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
      </controls> 
     </pages> 
     <httpHandlers> 
      <remove verb="*" path="*.asmx"/> 
      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/> 
     </httpHandlers> 
     <httpModules> 
      <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
     </httpModules> 
    </system.web> 
    <system.codedom> 
     <compilers> 
      <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
       <providerOption name="CompilerVersion" value="v3.5"/> 
       <providerOption name="WarnAsError" value="false"/> 
      </compiler> 
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
       <providerOption name="CompilerVersion" value="v3.5"/> 
       <providerOption name="OptionInfer" value="true"/> 
       <providerOption name="WarnAsError" value="false"/> 
      </compiler> 
     </compilers> 
    </system.codedom> 
    <system.web.extensions> 
     <scripting> 
      <webServices> 
       <!-- 
       Uncomment this section to enable the authentication service. Include 
       requireSSL="true" if appropriate. 

      <authenticationService enabled="true" requireSSL = "true|false"/> 
      --> 
       <!-- 
       Uncomment these lines to enable the profile service, and to choose the 
       profile properties that can be retrieved and modified in ASP.NET AJAX 
       applications. 

      <profileService enabled="true" 
          readAccessProperties="propertyname1,propertyname2" 
          writeAccessProperties="propertyname1,propertyname2" /> 
      --> 
       <!-- 
       Uncomment this section to enable the role service. 

      <roleService enabled="true"/> 
      --> 
      </webServices> 
      <!-- 
     <scriptResourceHandler enableCompression="true" enableCaching="true" /> 
     --> 
     </scripting> 
    </system.web.extensions> 
    <!-- 
     The system.webServer section is required for running ASP.NET AJAX under Internet 
     Information Services 7.0. It is not necessary for previous version of IIS. 
    --> 
    <system.webServer> 
     <validation validateIntegratedModeConfiguration="false"/> 
     <modules> 
      <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
     </modules> 
     <handlers> 
      <remove name="WebServiceHandlerFactory-Integrated"/> 
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
      <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
      <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
     </handlers> 
    </system.webServer> 
    <system.serviceModel> 
     <services> 
      <service name="Service" behaviorConfiguration="ServiceBehavior"> 
       <!-- Service Endpoints --> 
       <endpoint address="" binding="wsHttpBinding" contract="IService"> 
        <!-- 
       Upon deployment, the following identity element should be removed or replaced to reflect the 
       identity under which the deployed service runs. If removed, WCF will infer an appropriate identity 
       automatically. 
      --> 
        <identity> 
         <dns value="localhost"/> 
        </identity> 
       </endpoint> 
       <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
     <host> 
      <baseAddresses> 
      <add baseAddress="http://localhost:8000/" /> 
      </baseAddresses> 
     </host> 
     </service> 
     </services> 
     <behaviors> 
      <serviceBehaviors> 
       <behavior name="ServiceBehavior"> 
        <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above 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="false"/> 
       </behavior> 
      </serviceBehaviors> 
     </behaviors> 
    </system.serviceModel> 
</configuration> 

Edit 2 - ich den Absatz über das Erstellen eines Delphi Win32-Client entfernt haben seit Delphi 2007 nicht der Fall ist Unterstützung von SOAP 1.2, was der WCF-Dienst verwendet. Delphi 2007 unterstützt nur SOAP 1.0 ... Also wird der Client jetzt eine C# WinForms App sein.

+0

Sie haben den Service-Host als Port 8000 installiert? – Lazarus

+0

Ja (dem Leitfaden folgend, den ich verlinkt habe). Ich habe Port 80 auch versucht. Keine Freude. – Pauk

+0

Bitte poste die web.config, ich vermute es ist ein Config Problem. – Lazarus

Antwort

4

Antwort für mich war die folgende (zur Verfügung gestellt von Lazarus in den Kommentaren, aber ist nicht zurückgekommen, als Antwort zu schreiben):

  1. Feuert Internet Information Services (IIS) -Manager.
  2. Geöffnet die Websites Ordner und ausgewählt der Website in Frage.
  3. rechts geklickt es, dann ausgewählt Web Site verwalten und dann Erweiterte Einstellungen ...
  4. Auf dem resultierenden Popup trat ich http in den Aktivierte Protokolle Reihe.
  5. Das Popup geschlossen und die Site neu gestartet, und das war es. Fest!
1

Ich fand, dass es fast immer ein Problem mit der Art und Weise ist die endpoint, bindings, und/oder die behavior konfiguriert ist.

Wenn Ihre Website in IIS keine HTTP-Bindung aufweist, stellen Sie sicher, dass Sie httpGet httpGetEnabled = 'false' in der Konfiguration configuration/system.serviceModel/behaviors/serviceBehaviors/behavior/serviceMetadata für Ihren WCF-Dienst explizit festlegen. Der obige Pfad bezieht sich natürlich auf Ihre Web- oder app.config-Datei.

Wenn Sie einen Endpunkt mit 'http: //' in der Adresse haben, entfernen Sie ihn. WCF beachtet diese Dinge und wird die gleiche mehrdeutige Fehlermeldung werfen. Es gibt eine ganze Irrgarten Fehlkonfigurationen, die die gleichen Fehlermeldungen erzeugen. (Ich hasse das über WCF.) Ich, die es spezifischer war wie: "Hey Dumm wie #! Sie haben ein HTTP in einer Ihrer Endpunkt-Adressen, aber IIS hat keine HTTP-Bindung!" Auf diese Weise werde ich meinen Schwanz nicht verfolgen.

Ebenso verwende ich nie die mex Endpunkte, da sie mehr Mühe sind, als sie wert sind. Verwenden Sie stattdessen die Attribute httpsHelpPageUrl und httpsHelpPageEnabled im Konfigurationselement configuration/system.serviceModel/behaviors/serviceBehaviors/behavior/serviceDebug (vorausgesetzt, Sie verwenden HTTPS).

0

Antwort für mich war zu deaktivieren und dann wieder aktivieren Metadaten über HTTP.

  1. Feuert Internet Information Services (IIS) -Manager.
  2. Geöffnet die Websites Ordner und ausgewählt der Website in Frage.
  3. geklickt Recht es, dann ausgewählt WCF verwalten und WF Dienstleistungen und dann Konfigurieren ...
  4. Auf dem Allgemeinen Registerkarte I ungeprüft Metadaten aktivieren über HTTP (ja, es wurde überprüft bereits).
  5. Klicken Sie auf Anwenden (und bestätigte die Recycling-Anwendung Warnung).
  6. Geprüft Aktivieren Sie Metadaten über HTTP.
  7. Klicken Sie auf Apply (und bestätigte die Recycling-Anwendung Warnung), und das war es. Fest!

... Oder vielleicht ein AppPool Recycling wäre genug.

Verwandte Themen