IIS 7.0 throw Unhandled Exception of the Exception Application Block

Topics: Exception Handling Application Block
Sep 3, 2009 at 3:09 PM

Hi Guys,

 

I have an application that use the Exception Applicatin Block 3.1 and it runs fine in the my machine with XP and in the server with IIS 6.0.

I published in IIS 7.0 and for some reason I get "Unhandled Exception of the exception myapp.customexception" . Do I need to add something else to the web.config or to register my exception in any additional place?

 

Thank you very much in advance.

Sep 4, 2009 at 2:44 AM

Hi,

What is the exact exception you've encountered? Can you post it? I would assume that you've already configured your config for the exception handling and it is deployed together with your app which is a basic step to make it work.

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Sep 4, 2009 at 10:42 PM

Hi,

Thanks for your reply.

I paste the exception below. I also paste the web.config.

I did the configuration in the web.config and it worked fine in IIS 6.0, I believe the problem is that I have to add something else in IIS 7.0 either in the IIS or web.config.  The .dll are in the BIN folder

 

---------------------------

Server Error in '/ACS' Application.

Exception of type 'TripleS.Enterprise.Library.ExceptionManager.ExceptionHandling.SSSSecurityException' was thrown.

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: TripleS.Enterprise.Library.ExceptionManager.ExceptionHandling.SSSSecurityException: Exception of type 'TripleS.Enterprise.Library.ExceptionManager.ExceptionHandling.SSSSecurityException' was thrown.

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:

[SSSSecurityException: Exception of type 'TripleS.Enterprise.Library.ExceptionManager.ExceptionHandling.SSSSecurityException' was thrown.]
TripleS.Enterprise.Security.PermissionProvider.CodePermission.CreatePermission() +1208
System.Security.PermissionSet.CreateSerialized(Object[] attrs, Boolean serialize, Byte[]& nonCasBlob, PermissionSet& casPset, HostProtectionResource fullTrustOnlyResources) +252
TripleS.ACS.BusinessControllers.BusinessBusinessController.Load() in C:\AdjustmentControlSystem\ACS\TripleS.ACS.BusinessControllers\BusinessBusinessController.vb:163

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +808
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +38
System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +897
System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1848
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +27
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +261
Telerik.Web.UI.GridTableView.PerformSelect() +9
Telerik.Web.UI.GridTableView.DataBind() +363
Telerik.Web.UI.RadGrid.DataBind() +73
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +95
System.Web.UI.Control.EnsureChildControls() +146
Telerik.Web.UI.GridBaseDataList.get_Controls() +20
Telerik.Web.UI.RadAjaxControl.PopulatePlainPanels(Control parent, List`1 list, Control root) +109
Telerik.Web.UI.RadAjaxControl.OnPagePreRender(Object sender, EventArgs e) +1332
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Control.OnPreRender(EventArgs e) +11022094
System.Web.UI.Control.PreRenderRecursiveInternal() +108
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3394


Version Information: Microsoft .NET Framework Version:2.0.50727.3074; ASP.NET Version:2.0.50727.3601

 

Web.Config

--------------------

<?xml version="1.0"?>
<configuration>
    <configSections>
        <!-- Exception Handler -->
        <section name="exceptionHandling" type="TripleS.Enterprise.Library.ExceptionManager.ExceptionHandling.Configuration.ExceptionHandlingSettings, TripleS.Enterprise.Library.ExceptionManager.ExceptionHandling"/>
        <section name="dataConfiguration" type="TripleS.Enterprise.Library.Data.Configuration.DatabaseSettings, TripleS.Enterprise.Library.Data, Version=3.1.0.0, Culture=neutral, PublicKeyToken=af35a6d8290ef9f4"/>
        <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>
    <connectionStrings>
           <!--Normal Connection String for the application-->
        <add name="Connection String" connectionString="Data Source=TSMOTSTDEVDOD01;Initial Catalog=AdjustmentControlSystem;Integrated Security=True" providerName="System.Data.SqlClient"/>
        <!--Connection String for Security Database-->
        <add name="Connection Security String" connectionString="Data Source=TSMOTSTDEVDOD01;Initial Catalog=SecurityFramework;Integrated Security=True" providerName="System.Data.SqlClient"/>
        <!--Connection String for Exception Management log-->
        <add name="ConnectionStringEH" connectionString="Data Source=TSMOTSTDEVDOD01;Initial Catalog=ExceptionFramework;Integrated Security=True" providerName="System.Data.SqlClient"/>
    </connectionStrings>
    <dataConfiguration defaultDatabase="Connection String"/>
    <appSettings>
        <!--Name of the application to identify in SecurityFramework and ExceptionFramework-->
        <!--The name must be update in 4 areas in web.config-->
        <add key="ApplicationName" value="ACS"/>
        <!--Default Date for empty values-->
        <add key="DefaultDate" value="12/31/2078"/>
        <!--Default ACS users-->
        <add key="ADGROUP" value="ACS Global Role"/>
        <!--Domain Information for authentification using Active Directory User-->
          <!--En Domain Information-->
        <!--Exception Keys. Mail to be use when a exception happen-->
          <!--Exception Keys. Step to do when a exception happen, windowslog=log in windows viewer, filelog=create a file in log folder locally, exceptionmanger=log in database,notifyadministrators=send an email to administrators of the database in admin table-->
        <add key="ExceptionHandlerLog" value="exceptionmanager,windowslog,filelog,notifyadministrators"/>
        <!--Default Values for Adjustment Events-->
        <add key="ReturnEvent" value="1"/>
        <add key="ReceiveEvent" value="2"/>
        <add key="InProcessEvent" value="3"/>
        <add key="PendingEvent" value="4"/>
        <add key="HoldEvent" value="6"/>
        <!--Default Values for Claim Froms-->
        <add key="Dental" value="1"/>
        <add key="Professional" value="2"/>
        <add key="Institutional" value="3"/>
        <!--User, Password and domain to call QNXT Web Services-->
        <add key="QUserDomain" value="tsm"/>
        <add key="QUser" value="netfrmsrv"/>
        <add key="QPwd" value="man1za2na&amp;"/>
        <add key="QEnvId" value="1"/>
        <add key="TripleS.ACS.Service.External.ACSOnlineCompleteValidation" value="http://tsmitstdevpcr01:7333/wsh/services/RealTime/ACSOnlineCompleteValidation"/>
        <add key="QCSIMasterService_Providers_ProviderLDL" value="http://tsmqmodqaapp01/QCSIMasterService/ProviderQNXT.asmx"/>
        <add key="QCSIMasterService_CarrierQQNXT_CCarrierDataLDL" value="http://tsmqmodqaapp01/QCSIMasterService/CarrierQQNXT.asmx"/>
        <add key="QCSIMasterService_CarrierProgramQNXT_CarrierProgramLDL" value="http://tsmqmodqaapp01/QCSIMasterService/CarrierProgramQNXT.asmx"/>
        <add key="QCSIAuthentication_Authentication" value="http://tsmqmodqaapp01/QCSIMasterService/Authentication.asmx"/>
    </appSettings>
    <system.net>
        <mailSettings>
            <smtp from="@.com">
                <network host="tsm-edpexc01" port="25" userName="\" password="!" defaultCredentials="true"/>
            </smtp>
        </mailSettings>
    </system.net>
    <exceptionHandling>
        <exceptionPolicies>
            <add name="SSSPolicy">
                <exceptionTypes>
                    <add name="Exception" type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" postHandlingAction="None">
                        <exceptionHandlers>
                            <add name="Custom Handler" type="TripleS.Enterprise.Library.ExceptionManager.ExceptionHandling.SSSExceptionHandler, TripleS.Enterprise.Library.ExceptionManager.ExceptionHandling"/>
                        </exceptionHandlers>
                    </add>
                </exceptionTypes>
            </add>
            <add name="SSSReThrowPolicy">
                <exceptionTypes>
                    <add name="Exception" type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" postHandlingAction="None">
                        <exceptionHandlers>
                            <add name="Custom Handler" type="TripleS.Enterprise.Library.ExceptionManager.ExceptionHandling.SSSReThrowExceptionHandler, TripleS.Enterprise.Library.ExceptionManager.ExceptionHandling"/>
                        </exceptionHandlers>
                    </add>
                </exceptionTypes>
            </add>
        </exceptionPolicies>
    </exceptionHandling>
    <system.web>
        <customErrors mode="Off"/>

        <!--Impersonate user to connect to database using a commun user for security-->
        <identity impersonate="true" userName="tsmpassword="!"/>
        <!--End Impersonate-->
        <membership defaultProvider="DefaultMembershipProvider">
            <providers>
                <clear/>
                <add name="DefaultMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="Connection Security String" requiresQuestionAndAnswer="false" applicationName="ACS"/>
            </providers>
        </membership>
        <profile defaultProvider="SqlProvider">
            <providers>
                <clear/>
                <add name="SqlProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="Connection Security String" applicationName="ACS"/>
            </providers>
            <properties>
                <add name="FirstName"/>
                <add name="LastName"/>
                <add name="Address"/>
                <add name="City"/>
                <add name="State"/>
                <add name="Country"/>
                <add name="ZipCode"/>
                <add name="PhoneNumber"/>
            </properties>
        </profile>
        <roleManager defaultProvider="roleProvider" enabled="true" cacheRolesInCookie="true" cookieName=".ASPROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="true" cookieSlidingExpiration="true" cookieProtection="All">
            <providers>
                <add name="roleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="Connection Security String" applicationName="ACS"/>
            </providers>
        </roleManager>
        
            <authentication mode="Forms">
                <forms loginUrl="~/Login/LoginAD.aspx" defaultUrl="~/Default.aspx"></forms>
            </authentication>
        
    <pages>
            <controls>
                <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" tagPrefix="cc1"/>
                <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></controls>
        </pages>
        <!--
          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="false">
            <assemblies>
                <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                <add assembly="Telerik.Web.Design, Version=2009.2.701.35, Culture=neutral, PublicKeyToken=121FAE78165BA3D4"/>
                <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.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies>
        </compilation>
        <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>

  <location path="WebPages">
    <system.web>
      <authorization>
        <deny users="?" />
      </authorization>
    </system.web>
  </location>
 
    <system.web.extensions>
        <scripting>
            <webServices>
                <!-- Uncomment this line to customize maxJsonLength and add a custom converter -->
                <!--
      <jsonSerialization maxJsonLength="500">
        <converters>
          <add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>
        </converters>
      </jsonSerialization>
      -->
                <!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->
                <!--
        <authenticationService enabled="true" requireSSL = "true|false"/>
      -->
                <!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved
           and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and
           writeAccessProperties attributes. -->
                <!--
      <profileService enabled="true"
                      readAccessProperties="propertyname1,propertyname2"
                      writeAccessProperties="propertyname1,propertyname2" />
      -->
            </webServices>
            <!--
      <scriptResourceHandler enableCompression="true" enableCaching="true" />
      -->
        </scripting>
    </system.web.extensions>
    <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
        <modules>
            <remove name="ScriptModule"/><add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        </modules>
        <handlers>
            <remove name="ScriptHandlerFactory"/>
            <remove name="ScriptHandlerFactoryAppServices"/>
            <remove name="ScriptResource"/><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"/>
            <add name="Telerik.Web.UI.WebResource"  path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2009.2.701.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" />
        </handlers>
    </system.webServer>
    <system.codedom>
            <compilers>
                <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
                    <providerOption name="CompilerVersion" value="v3.5"/>
                    <providerOption name="WarnAsError" value="false"/></compiler>
                <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
                    <providerOption name="CompilerVersion" value="v3.5"/>
                    <providerOption name="OptionInfer" value="true"/>
                    <providerOption name="WarnAsError" value="false"/></compiler></compilers></system.codedom>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
                <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/></dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
                <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/></dependentAssembly></assemblyBinding></runtime></configuration>

 

Sep 7, 2009 at 9:00 AM

Hi,

I'm not really sure about this one. What is that SSSSecurityException? Is it your custom exception class?  Also, I've noticed that you are using your own custom handler what does your custom handler do?

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Sep 7, 2009 at 6:59 PM

Hi,

The SSSSecurityExpception is a type of Expcetion throw when is deny the access to a page or action. The Handler was created to use some workflows from our support system, so it send email or save in the support database.

This worked fine in IIS6.0. Do you do if I have to do something else in IIS 7.0 like register the assembly, add something else in web.config or do any configuration in the IIS7. I am using strong assemblies and all are in the bin folder.

Any ideas?

 

Sep 8, 2009 at 3:24 AM
Edited Sep 8, 2009 at 3:27 AM

Have you configured the security settings for IIS7? There are some changes in security between IIS6 and IIS7 http://learn.iis.net/page.aspx/110/changes-between-iis6-and-iis7-security/ .

Sep 8, 2009 at 5:45 PM

SSSSecurityException is a custom exception class that is send when the person doesnt have access to the app. It is not related with the security of the IIS, it is in the code. The problem is that the IIS 7.0 do not handle the exceptions or the custom handlers.

I believe is something that I must do in the web.config but I dont know if there is any addtional line that I have to write for IIS 7.0.

Any ideas?

 

Sep 8, 2009 at 9:53 PM

I found it, finally.

The problem is the Application Pool. I change it to Classic .Net AppPool that have the "ManagePipelineMode = Classic", the other option is Integrated. For some reason it doesnt work with Integrated.

Thank you very much to take the time to answer. I really apreciate it.

Best Regards.