2009-07-22 26 views
5

Después de configurar un servicio WCF en mi cuadro dev, me aparece un error al acceder a él. Establecí el service up as per this guide. Está escrito en VS2008/C#/.NET 3.5 y mi cuadro dev es Vista SP2 con IIS 7. Por el momento, el servicio no es más que la estructura por defecto, ya que estoy literalmente después de probar una conexión.Problema con el servicio WCF: el protocolo 'http' no es compatible. ¿Cómo resolver?

He comprobado lo que necesita ser instalado y estoy bastante seguro de que tengo todo lo permitido, siguiente captura de pantalla muestra las opciones actuales: mensaje de error

Windows IIS Options

completa sobre cómo acceder a http://localhost:8000/Service.svc es el siguiente:

Server Error in '/' Application. 
-------------------------------------------------------------------------------- 

The protocol 'http' is not supported. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: The protocol 'http' is not supported. 

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace: 


[InvalidOperationException: The protocol 'http' is not supported.] 
    System.ServiceModel.AsyncResult.End(IAsyncResult result) +11536522 
    System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +194 
    System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext) +176 
    System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e) +278 
    System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68 
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75 


-------------------------------------------------------------------------------- 
Version Information: Microsoft .NET Framework Version:2.0.50727.4016; ASP.NET Version:2.0.50727.4016 

Cualquier sugerencia sobre cómo solucionar la falla/reparación del error sería muy bien recibida. Buscar en Google el error brinda muy poca ayuda. ¡Probablemente me he perdido algo realmente obvio!

Editar - web.config conforme a lo solicitado (disculpas por su longitud):

<?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> 

Editar 2 - He quitado el párrafo sobre la creación de un cliente Delphi Win32 desde Delphi 2007 no lo hace soporte SOAP 1.2, que es lo que usa el Servicio WCF. Delphi 2007 solo es compatible con SOAP 1.0 ... Entonces, el cliente ahora será una aplicación C# WinForms.

+0

¿Has instalado el host de servicio como puerto 8000? – Lazarus

+0

Sí (siguiendo la guía que he vinculado). También probé el puerto 80. Sin alegría. – Pauk

+0

Por favor, publique el web.config, sospecho que es un problema de configuración. – Lazarus

Respuesta

4

respuesta para mí era la siguiente (proporcionado por Lázaro en los comentarios, pero no ha vuelto a publicar como una respuesta):

  1. Fired up de Internet Information Server (IIS).
  2. Abrió la carpeta Sitios y seleccionó el Sitio en la pregunta.
  3. clic derecho que, a continuación, selecciona Administrar sitio Web y luego Configuración avanzada ...
  4. En la ventana que aparece, entré en http en los Protocolos habilitados fila.
  5. Cerré la ventana emergente y reinicié el sitio, y eso fue todo. ¡Fijo!
1

He encontrado que es casi siempre un problema con la forma en la endpoint, bindings, y/o la behavior está configurado.

En su mayor parte, si su sitio web en IIS no tiene un enlace HTTP, asegúrese de configurar explícitamente httpGet httpGetEnabled = 'false' en la configuración configuration/system.serviceModel/behaviors/serviceBehaviors/behavior/serviceMetadata correspondiente a su servicio WCF. La ruta de acceso anterior se refiere a su archivo web o app.config.

Además, si tiene un punto final que tiene 'http: //' en la dirección, elimínelo. WCF presta atención a estas cosas y lanzará el mismo mensaje de error ambiguo. Hay un laberinto entero de configuraciones erróneas que producen los mismos mensajes de error. (Odio eso sobre WCF.) Yo que era más específico como: "¡Hola, dumm como #! ¡Tienes un HTTP en una de tus direcciones de punto final, pero IIS no tiene enlace HTTP!" ; P Al menos de esta manera no estaré persiguiendo mi cola.

Del mismo modo, nunca utilizo los puntos finales mex ya que son más problemáticos de lo que valen. En su lugar, utilice los atributos httpsHelpPageUrl y httpsHelpPageEnabled en el elemento de configuración configuration/system.serviceModel/behaviors/serviceBehaviors/behavior/serviceDebug (suponiendo que esté usando HTTPS).

0

La respuesta para mí era deshabilitar y luego habilitar de nuevo Metadatos Sobre HTTP.

  1. Fired up de Internet Information Server (IIS).
  2. Abrió la carpeta Sitios y seleccionó el Sitio en la pregunta.
  3. clic derecho que, a continuación, selecciona Administrar WCF y WF Servicios y luego Configurar ...
  4. En la ficha general, que yo no se Activar metadatos a través de HTTP (sí, se comprobó ya).
  5. Haga clic en Aplicar (y confirmó la advertencia de la aplicación de reciclaje).
  6. Marcado Habilitar metadatos sobre HTTP.
  7. Haga clic en Aplicar (y confirmó la advertencia de la aplicación de reciclaje), y eso fue todo. ¡Fijo!

... O tal vez un reciclaje de AppPool sería suficiente.

Cuestiones relacionadas