I have a WCF Server running on IIS 7 using default application pool, with SSL activate, the services is installed in a SBS Server 2008.
I implement client application services with wcf and SQL 2005 for setting the access control in my application. The application run under windows vista and is make with WPF.
In my developer machine the application and the WCF services run well, the IIS i'm use for the trials is the local IIS 7 and the database is the SQL Server 2005 database hosting in my server. I'm using Visual Studio Project Designer to enable and configure client application services. using https://localhost/WcfServidorFundacion
.
When i'm change the authentication services location to https://WcfServices:5659/WcfServidorFundacion
and recompile the application, the following error show up.
Message:
The web service returned the error status code: InternalServerError. Details of service failure: {"Message":" Error while processing your request ","StackTrace":"","ExceptionType":""}
Stack Trace: en System.Net.HttpWebRequest.GetResponse() en System.Web.ClientServices.Providers.ProxyHelper.CreateWebRequestAndGetResponse(String serverUri, CookieContainer& cookies, String username, String connectionString, String connectionStringProvider, String[] paramNames, Object[] paramValues, Type returnType)
InnerException: System.Net.WebException Message="Remote Server Error: (500) Interal 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 make a capture of the response but I'cant post it because i don't have 10 reputation points
I activate the error log in the IIS 7 server, and the result is a Warning in the ManagedPipilineHandler. I appreciate if any one can help me
Errors & Warnings No.↓ Severity Event Module Name
132. view trace Warning -MODULE_SET_RESPONSE_ERROR_STATUS ModuleName ManagedPipelineHandler Notification 128 HttpStatus 500 HttpReason Internal Server Error HttpSubStatus 0 ErrorCode 0 ConfigExceptionInfo Notification EXECUTE_REQUEST_HANDLER ErrorCode La operación se ha completado correctamente. (0x0)Maybe this can help, is the 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" connectionStr开发者_JS百科ingName="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>
When using WCF its always good to try to get as much visibility as possible. There are two tools that I often use. They are the WCF Trace Viewer and WCF Config Editor
- SvcConfigEditor.exe
- SvcTraceViewer.exe
Depending if you are on a x64 or x84 machine and the version of .Net they should be located either.
- C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\
- C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\
- C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Bin
- C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin Check out
Check out http://merbla.blogspot.com/2009/02/wcf-tools.html
精彩评论