WCF Authentication in IIS7

I have a WCF server running on IIS 7 using the default application pool. When SSL is activated, the services are installed on SBS Server 2008. I implement client applications with wcf and SQL 2005 to set access control in my application. The application runs under Windows Vista and does with WPF. On my developer's machine, the WCF application and services work well, the IIS I use for testing is local IIS 7, and the database is the SQL Server 2005 database database on my server. I use Visual Studio Project Designer to enable and configure client applications. using https://localhost/WcfServidorFundacion. When I change the location of authentication services tohttps://WcfServices:5659/WcfServidorFundacionand recompile the application, the following error message appears. Message: The web service returned an error status code: InternalServerError. Service Failure Details: {"Message": "Error processing your request," "StackTrace": "," ExceptionType ":" "}

Stack Trace: ru System.Net.HttpWebRequest.GetResponse () ru. System.Web.ClientServices.Providers.ProxyHelper.CreateWebRequestAndGetResponse (String serverUri, CookieContainer and cookies, String username, String connectionString, String connectionStringProvider, String [] paramNames, Object [] paramValues, Type returnType)

InnerException: System.Net.WebException Message = "Remote Server Error: (500) Gateway Server Error."

I can access the WCF service from the navigator using the URL mentioned above, and even make a webReference in my project. I am capturing an answer, but I will send it because I do not have 10 reputation points.

I activate the error log on IIS 7 and the result is a warning in ManagedPipilineHandler. I appreciate if anyone can help me.

Errors and warnings No. ↓ Name of an event module of importance
132. Viewing a trace Warning -MODULE_SET_RESPONSE_ERROR_STATUS ModuleName ManagedPipelineHandler Notification 128 HttpStatus 500 Internal server error HttpReason HttpSubStatus 0 ErrorCode 0 ConfigExceptionInfo
Launcher EXECUTE_REEREST INFORMATION ConfirmException_Firmware Verify_default (0x0)

Perhaps this may help, this is my web.config of my service

<?xml version="1.0" encoding="utf-8"?>
<!--
    Nota: como alternativa para editar manualmente este archivo, puede utilizar la 
 herramienta Administración de sitios web para configurar los valores de la aplicación. Utilice
 la opción Sitio Web->Configuración de Asp.Net en Visual Studio.
 Encontrará una lista completa de valores de configuración y comentarios en 
    machine.config.comments, que se encuentra generalmente en 
    \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>
    <remove name="LocalMySqlServer" />
    <remove name="LocalSqlServer" />
    <add name="fundacionSelfAut" connectionString="Data Source=FUNDACIONSERVER/PRUEBAS;Initial Catalog=fundacion;User ID=wcfBaseDatos;Password=qwerty_2009;" providerName="System.Data.SqlClient" />
  </connectionStrings>



  <system.web>

    <profile enabled="true" defaultProvider="SqlProfileProvider">
      <providers>
        <clear />
        <add name="SqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="fundacionSelfAut" applicationName="fundafe" />
      </providers>
      <properties>
        <add name="FirstName" type="String" />
        <add name="LastName" type="String" />
        <add name="PhoneNumber" type="String" />
      </properties>
    </profile>

    <roleManager enabled="true" defaultProvider="SqlRoleProvider">
      <providers>
        <clear />
        <add name="SqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="fundacionSelfAut" applicationName="fundafe" />
      </providers>
    </roleManager>

    <membership defaultProvider="SqlMembershipProvider">
      <providers>
        <clear />
        <add name="SqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="fundacionSelfAut" applicationName="fundafe" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="true" requiresUniqueEmail="true" passwordFormat="Hashed" />
      </providers>
    </membership>

    <authentication mode="Forms" />
    <compilation debug="true" strict="false" explicit="true">
      <assemblies>
        <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </assemblies>
    </compilation>
    <!--
            La sección <authentication> permite la configuración 
            del modo de autenticación de seguridad utilizado por 
            ASP.NET para identificar a un usuario entrante. 
        -->
    <!--
            La sección <customErrors> permite configurar las 
            acciones que se deben llevar a cabo/cuando un error no controlado tiene lugar 
            durante la ejecución de una solicitud. Específicamente, 
            permite a los desarrolladores configurar páginas de error html 
            que se mostrarán en lugar de un seguimiento de pila de errores.

        <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>
    <sessionState timeout="40" />


  </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>
    </compilers>

  </system.codedom>


  <!--
        La sección webServer del sistema es necesaria para ejecutar ASP.NET AJAX en Internet
        Information Services 7.0. Sin embargo, no es necesaria para la versión anterior de 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>
    <tracing>
      <traceFailedRequests>
        <add path="*">
          <traceAreas>
            <add provider="ASP" verbosity="Verbose" />
            <add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" />
            <add provider="ISAPI Extension" verbosity="Verbose" />
            <add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module" verbosity="Verbose" />
          </traceAreas>
          <failureDefinitions statusCodes="401.3,500,403,404,405" />
        </add>
      </traceFailedRequests>
    </tracing>
    <security>
      <authorization>
        <add accessType="Allow" users="germanbarbosa,informatica" />
      </authorization>
      <authentication>
        <windowsAuthentication enabled="false" />
      </authentication>
    </security>
  </system.webServer>

  <system.web.extensions>
    <scripting>
      <webServices>
        <authenticationService enabled="true" requireSSL="true" />
        <profileService enabled="true" readAccessProperties="FirstName,LastName,PhoneNumber" />
        <roleService enabled="true" />
      </webServices>
    </scripting>
  </system.web.extensions>


  <system.serviceModel>
    <services>
      <!-- this enables the WCF AuthenticationService endpoint -->
      <service behaviorConfiguration="AppServiceBehaviors" name="System.Web.ApplicationServices.AuthenticationService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="userHttps" bindingNamespace="http://asp.net/ApplicationServices/v200" contract="System.Web.ApplicationServices.AuthenticationService" />
      </service>
      <!-- this enables the WCF RoleService endpoint -->
      <service behaviorConfiguration="AppServiceBehaviors" name="System.Web.ApplicationServices.RoleService">
        <endpoint binding="basicHttpBinding" bindingConfiguration="userHttps" bindingNamespace="http://asp.net/ApplicationServices/v200" contract="System.Web.ApplicationServices.RoleService" />
      </service>
      <!-- this enables the WCF ProfileService endpoint -->
      <service behaviorConfiguration="AppServiceBehaviors" name="System.Web.ApplicationServices.ProfileService">
        <endpoint binding="basicHttpBinding" bindingNamespace="http://asp.net/ApplicationServices/v200" bindingConfiguration="userHttps" contract="System.Web.ApplicationServices.ProfileService" />
      </service>

    </services>

    <bindings>
      <basicHttpBinding>
        <!-- Set up a binding that uses Username as the client credential type -->
        <binding name="userHttps">
          <security mode="Transport">
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>

    <behaviors>
      <serviceBehaviors>
        <behavior name="AppServiceBehaviors">
          <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceAuthorization principalPermissionMode="UseAspNetRoles" roleProviderName="SqlRoleProvider" />
          <serviceCredentials>
            <userNameAuthentication userNamePasswordValidationMode="MembershipProvider" membershipProviderName="SqlMembershipProvider" />
          </serviceCredentials>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
  </system.serviceModel>

</configuration>
+3
1

WCF . , . WCF Trace Viewer WCF.

  • SvcConfigEditor.exe
  • SvcTraceViewer.exe

, x64 x84 .Net, .

  • C:\Program Files\Microsoft SDK\Windows\v6.0A\bin\
  • C:\Program Files\Microsoft SDK\Windows\v7.0A\bin\
  • C:\Program Files (x86)\Microsoft SDK\Windows\v6.0A\Bin
  • C:\Program Files (x86)\Microsoft SDK\Windows\v7.0A\Bin

http://merbla.blogspot.com/2009/02/wcf-tools.html

0

Source: https://habr.com/ru/post/1724942/


All Articles