I am trying to log to the console via nlog and am getting an exception:
Unhandled Exception: System.TypeInitializationException: The type initializer fo
r 'MyApp' threw an exception. ---> System.Configuration.ConfigurationEr
rorsException: An error occurred creating the configuration section handler for
nlog: Exception occurred when loading configuration from C:\MyApp\MyApp.exe.config (C:\MyApp\MyApp.exe.config line 14) --->
NLog.NLogConfigurationException: Exception occurred when loading configuration f
rom C:\MyApp\MyApp.exe.config ---> System.ArgumentException: T
arget cannot be found: 'Console'
at NLog.Config.Factory`2.CreateInstance(String name)
at NLog.Config.XmlLoggingConfiguration.ParseTargetsElement(NLogXmlElement tar
getsElement)
at NLog.Config.XmlLoggingConfiguration.ParseNLogElement(NLogXmlElement nlogEl
ement, String baseDirectory)
at NLog.Config.XmlLoggingConfiguration.ParseTopLevel(NLogXmlElement content,
String baseDirectory)
at NLog.Config.XmlLoggingConfiguration.Initialize(XmlReader reader, String fi
leName, Boolean ignoreErrors)
--- End of inner exception stack trace ---
at NLog.Config.XmlLoggingConfiguration.Initialize(XmlReader reader, String fi
leName, Boolean ignoreErrors)
at NLog.Config.XmlLoggingConfiguration..ctor(XmlElement element, String fileN
ame)
at NLog.Config.ConfigSectionHandler.System.Configuration.IConfigurationSectio
Here is my config file:
<configuration>
<configSections>
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
</configSections>
<nlog>
<targets>
<target name="c" type="Console" />
<!--<target name="logfile" type="File" fileName="log.txt" archiveAboveSize="10240" maxArchiveFiles="-1" />-->
</targets>
<rules>
<logger name="*" minlevel="Info" writeTo="c" />
</rules>
</nlog>
</configuration>
Here is the relevant code:
private static Logger logger = LogManager.GetLogger("MyApp");
I am compiling with mono with the following command:
dmcs -reference:NLog.dll MyApp.cs
I am using the latest? version of nlog from here, and I have 4.0 of the .Net framework. This app works fine on a Windows 7 Home PC (also .Net 4.0), but seems to throw this exception on my XP pro PC. I can't imagine that would be the difference, but being a .Net dummy I'm at a loss as to what the problem could be.
Has anyone seen this before or have any insights as to what the problem could be?
I have no idea why (though, I suspect it is a .Net framework versioning issue), but using nlog v1 instead of v2 did the trick.
r u use ${counter} or other function needed in NLog layout?
Related
Today I thought, Oh, I'll just add some SQL logging to a C# SFTP custom (console) program we have. I didn't write it, and it has perhaps an odd configuration file. It looks like the SQL Performance Counters require a well conformed config file? Add the catch for TypeInitializationException gave some more specific and useful info.
So I am getting the connection string from the app.config file, but to show why I'm frustrated, I hard-coded the connection string below. If I'm providing a full connection string, why would it go to the config file. Apparently SqlPerformanceCounters is picky about these things???
if (!String.IsNullOrWhiteSpace(SqlConnectionString))
{
try
{
WriteLogConsole("SqlConnectionObj - about to open with SqlConnectionString='" +
SqlConnectionString + "'");
//SqlConnection SqlConnectionObj = new SqlConnection(SqlConnectionString);
// Even using a hard-coded connection string I have this issue!
SqlConnection SqlConnectionObj = new SqlConnection("Server=abc;Database=MyDBName;Trusted_Connection=true");
SqlConnectionObj.Open();
WriteLogConsole("SqlConnectionObj - opened successfully");
}
catch (TypeInitializationException ex)
{
WriteLogConsole("TypeInitializationException=" + ex.ToString());
// don't stop, keep going. Logging is nice, but not critical
}
catch (SqlException ex)
{
WriteLogConsole("SqlException=" + ex.ToString());
// don't stop, keep going. Logging is nice, but not critical
}
catch (Exception ex)
{
WriteLogConsole("System.Exception=" + ex.Message);
// don't stop, keep going. Logging is nice, but not critical
}
}
The short version of the error thrown is this:
Unrecognized configuration section
CustomAppSettings/LogExceptionsToFile
Full exception:
SqlConnectionObj - about to open with SqlConnectionString='Server=abc;Database=MyDBName;Trusted_Connection=true'
Exception thrown: 'System.TypeInitializationException' in System.Data.dll
TypeInitializationException=System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SqlConnectionFactory' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SqlPerformanceCounters' threw an exception. ---> System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize ---> System.Configuration.ConfigurationErrorsException: Unrecognized configuration section CustomAppSettings/LogExceptionsToFile
at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
--- End of inner exception stack trace ---
at System.Configuration.ConfigurationManager.PrepareConfigSystem()
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
at System.Diagnostics.DiagnosticsConfiguration.GetConfigSection()
at System.Diagnostics.DiagnosticsConfiguration.Initialize()
at System.Diagnostics.DiagnosticsConfiguration.get_SwitchSettings()
at System.Diagnostics.Switch.InitializeConfigSettings()
at System.Diagnostics.Switch.InitializeWithStatus()
at System.Diagnostics.Switch.get_SwitchSetting()
at System.Data.ProviderBase.DbConnectionPoolCounters..ctor(String categoryName, String categoryHelp)
at System.Data.SqlClient.SqlPerformanceCounters..ctor()
at System.Data.SqlClient.SqlPerformanceCounters..cctor()
--- End of inner exception stack trace ---
at System.Data.SqlClient.SqlConnectionFactory..cctor()
--- End of inner exception stack trace ---
at System.Data.SqlClient.SqlConnection..cctor()
--- End of inner exception stack trace ---
at System.Data.SqlClient.SqlConnection..ctor(String connectionString)
at WinSCPWrapperGet.Program.Main(String[] args)
I think it's related to something like this.
What do I have to change to make it happy? I saw other posts about using but I don't have a group. I added everything below in as an attempt to fix the issue. The rest of the program runs fine and uses the config file as desired.
<configuration>
<configSections> <!-- this was not here when I first got the error,
me thinks I need something like to fix this issue -->
<sectionGroup name="CustomAppSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="MyApp.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
</startup>
<CustomAppSettings>
<!-- we have many more parms, but here is an example;
each SFTP site can have about 10 config parms -->
<Site1>
<add key="HostName" value="sftp.somesite1.com"/>
<add key="HostPort" value=""/>
</Site1>
<Site2>
<add key="HostName" value="sftp.somesite1.com"/>
<add key="HostPort" value=""/>
</Site2>
... etc...
NOTE: This is in production now, and I am enhancing it. We have maybe a few dozen config files in different scheduled tasks, so I would hate to change all of them, even if they are not designed perfectly.
Found this: https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/performance-counters
It tells us that we can tune the performance counters in the config file:
<system.diagnostics>
<switches>
<add name="ConnectionPoolPerformanceCounterDetail"
value="4"/>
</switches>
</system.diagnostics>
So bottom line, I just need to know how to make my config file work with SQL, even though the connection string in the config is not the issue.
The group is not needed, so far the following has got around the original issue:
<configuration>
<configSections>
<section name="CustomAppSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
</startup>
<CustomAppSettings>
etc...
Reference: https://blog.ivankahl.com/creating-custom-configuration-sections-in-app-config/
Please note I am answering my own question to help people in the future.
When I use NLog to log to a trace target type, it only works correctly if the level is Trace or Debug. If it's Info, Warn, or Error, it prepends extra info before my layout. If the level is Fatal, I get a pop-up complaining about a failed assertion and it says so in the output too. Is the trace target bugged?
Program.cs
using System;
namespace TraceLoggingTest
{
class Program
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
static void Main(string[] args)
{
logger.Trace("Hello Trace");
logger.Debug("Hello Debug");
logger.Info("Hello Info");
logger.Warn("Hello Warn");
logger.Error("Hello Error");
logger.Fatal("Hello Fatal");
Console.ReadLine();
NLog.LogManager.Shutdown();
}
}
}
NLog.config
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload="true"
throwExceptions="false"
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
<targets>
<target name="logTrace" xsi:type="Trace" layout="${message}" />
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="logTrace" />
</rules>
</nlog>
Expected output
Hello Trace
Hello Debug
Hello Info
Hello Warn
Hello Error
Hello Fatal
Actual output
Hello Trace
Hello Debug
TraceLoggingTest.exe Information: 0 : Hello Info
TraceLoggingTest.exe Warning: 0 : Hello Warn
TraceLoggingTest.exe Error: 0 : Hello Error
---- DEBUG ASSERTION FAILED ----
---- Assert Short Message ----
Hello Fatal
---- Assert Long Message ----
A fix for the prepending issue was introduced in Nlog 4.5. You need to add rawWrite="true" to the target statement. It also happens to fix the assertion problem.
Change:
<target name="logTrace" xsi:type="Trace" layout="${message}" />
To this:
<target name="logTrace" xsi:type="Trace" layout="${message}" rawWrite="true" />
From https://github.com/NLog/NLog/wiki/Trace-target:
Layout Options
rawWrite - Always use Trace.WriteLine independent of LogLevel. Default: False
Introduced with NLog 4.5, fixes the issue with output being prefixed with exe-filename.
Here are two discussions of the original problem:
https://github.com/NLog/NLog/issues/1968
https://github.com/NLog/NLog/issues/2234
I am trying to follow the tutorial PerfSDK to create a single user test for D365 operations (update 4). When I try to run a sample test (same for my recorded test), I get the following exception:
Test Name: CreatePurchReq
Test FullName: MS.Dynamics.Performance.Application.SCM.CreatePurchReqBase.CreatePurchReq
Test Source: J:\PerfSDK\PerfSDKLocalDirectory\SampleProject\PerfSDKSample\PurchaseReq.cs : line 85
Test Outcome: Failed
Test Duration: 0:00:00.20745
Result StackTrace:
at MS.Dynamics.TestTools.CloudCommonTestUtilities.Authentication.SelfMintedTokenAuthenticator.Initialize(AuthenticatorConfiguration configElement)
at MS.Dynamics.TestTools.CloudCommonTestUtilities.Authentication.AuthenticatorFactory.GetConfiguredAuthenticator(AuthenticatorConfiguration config)
at MS.Dynamics.TestTools.CloudCommonTestUtilities.Authentication.AuthenticatorFactory.GetConfiguredAuthenticator(String authenticatorId)
at MS.Dynamics.TestTools.CloudCommonTestUtilities.Authentication.AuthenticatorFactory.get_AdminAuthenticator()
at MS.Dynamics.TestTools.CloudCommonTestUtilities.Authentication.AuthenticatorFactory.get_AdminAuthenticatorToken()
at MS.Dynamics.TestTools.CloudCommonTestUtilities.Authentication.UserManagement.get_Service()
at MS.Dynamics.TestTools.CloudCommonTestUtilities.Authentication.UserManagement.PopulateAxUsers()
at MS.Dynamics.TestTools.CloudCommonTestUtilities.Authentication.UserManagement..cctor()
--- End of inner exception stack trace ---
at MS.Dynamics.TestTools.CloudCommonTestUtilities.Authentication.UserManagement.get_AdminUser()
at MS.Dynamics.Performance.Application.SCM.CreatePurchReqBase.TestSetup() in J:\PerfSDK\PerfSDKLocalDirectory\SampleProject\PerfSDKSample\PurchaseReq.cs:line 55
Result Message:
Initialization method MS.Dynamics.Performance.Application.SCM.CreatePurchReqBase.TestSetup threw exception. System.TypeInitializationException: System.TypeInitializationException: The type initializer for 'MS.Dynamics.TestTools.CloudCommonTestUtilities.Authentication.UserManagement' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CE.VaultSDK, Version=0.5.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
It seems like I might have made some mistake while configuring the CouldEnvironment.config file. But I am not able to figure it out. Could someone who have successfully set this up point me in the right direction?
This is how my CloudEnvironment.config file is setup:
<?xml version="1.0" encoding="utf-8"?>
<EnvironmentalConfigSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<EnvironmentalConfigSettingsCollection>
<EnvironmentalConfigSetting ConfigName="DEVFABRIC">
<!-- NOTE: the HostName value needs to be specified -->
<ExecutionConfigurations Key="HostName" Value="sands-testaos.sandbox.ax.dynamics.com" />
<ExecutionConfigurations Key="SoapHostName" Value="sands-testaossoap.sandbox.ax.dynamics.com" />
<ExecutionConfigurations Key="SelfSigningCertificateThumbprint" Value="86F447584D9DBB8C031BD8852211FC33EA2FCD54" />
<ExecutionConfigurations Key="AdminAuthenticatorConfigurationId" Value="SelfMintingAdminUser" />
<ExecutionConfigurations Key="DefaultBrowser" Value="InternetExplorer" />
<ExecutionConfigurations Key="FederationRealm" Value="spn:00000015-0000-0000-c000-000000000000" />
<ExecutionConfigurations Key="DefaultDispatcher" Value="Microsoft.Dynamics.TestTools.Dispatcher.JsDispatcher, Microsoft.Dynamics.TestTools.Dispatcher.JsDispatcher" />
<ExecutionConfigurationsNodes ConfigurationName="SVC">
<ConfigurationSpecificDetails Key="AppConfig" Value="DEVFABRIC.Config" />
</ExecutionConfigurationsNodes>
<ExecutionConfigurationsNodes ConfigurationName="PRF">
<ConfigurationSpecificDetails Key="UserCount" Value="10" />
<ConfigurationSpecificDetails Key="UserFormat" Value="TST_{0}#TAEOfficial.ccsctp.net" />
<ConfigurationSpecificDetails Key="UserRole" Value="-SYSADMIN-" />
<ConfigurationSpecificDetails Key="ThinkTime" Value="0" />
<ConfigurationSpecificDetails Key="Company" Value="USMF" />
</ExecutionConfigurationsNodes>
</EnvironmentalConfigSetting>
</EnvironmentalConfigSettingsCollection>
<AuthenticatorConfigurationCollection>
<AuthenticatorConfiguration Id="SelfMintingRunnerUser" Class="MS.Dynamics.TestTools.CloudCommonTestUtilities.Authentication.SelfMintedTokenAuthenticator">
<Credentials IsFromKeyVault="false" Username="daxrunneruser#daxmdsrunner.com" NetworkDomain="urn:Microsoft:Dynamics:Cloud:DaxRunner" />
</AuthenticatorConfiguration>
<AuthenticatorConfiguration Id="SelfMintingSysUser" Class="MS.Dynamics.TestTools.CloudCommonTestUtilities.Authentication.SelfMintedTokenAuthenticator">
<Credentials IsFromKeyVault="false" Username="testuser#microsoft.com" />
</AuthenticatorConfiguration>
<AuthenticatorConfiguration Id="SelfMintingAdminUser" Class="MS.Dynamics.TestTools.CloudCommonTestUtilities.Authentication.SelfMintedTokenAuthenticator">
<!-- NOTE: admin username needs to be specified -->
<!-- <Credentials IsFromKeyVault="false" Username="[Topology/Configuration/Setting[#Name='AxAdminAlias']/#Value]" /> -->
<Credentials IsFromKeyVault="false" Username="myusername#mycompany.com" Password="mypassword" />
</AuthenticatorConfiguration>
</AuthenticatorConfigurationCollection>
</EnvironmentalConfigSettings>
It looks like you need the resolve the System.IO.FileNotFoundException: Could not load file or assembly exception.
Which means you a probably missing the Microsoft.CE.VaultSDK assembly or one of its dependent assemblies from your environment.
Check out this question which has the same problem.
System.IO.FileNotFoundException: Could not load file or assembly 'X' or one of its dependencies when deploying the application
I encountered this error message and it was caused by the assembly reference to WebDriver.dll not being included in the solution.
The problem got resolved after the reference was added.
Microsoft article:
https://learn.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/perf-test/perfsdk-tutorial
These are the steps:
Download the selenium-dotnet-strongnamed-2.42.0.zip and IEDriverServer_Win32_2.42.0.zip files from http://selenium-release.storage.googleapis.com/index.html?path=2.42/.
Extract the files, and copy the dynamic-link libraries (DLLs) to the PerfSDK\Common\External\Selenium folder. Add a reference to WebDriver.dll to your project.
To enable further verbose .NET Fusion log, run the below Command on CMD prompt (Start -> search cmd -> open as Admin and run the below line) :
reg add HKLM\software\microsoft\fusion /v Enablelog /t REG_DWORD /d 1
I had this working, but I tried to update nlog and use the nuget packages, including NLog.Windows.Forms.
Now I am getting NLog.NLogConfigurationException with the inner exception:
Target cannot be found: 'RichTextBox'
The project references both: NLog and NLog.Windows.Forms
from packages.config:
<package id="NLog" version="4.3.4" targetFramework="net46" />
<package id="NLog.Config" version="4.3.4" targetFramework="net46" />
<package id="NLog.Schema" version="4.3.4" targetFramework="net46" />
<package id="NLog.Windows.Forms" version="4.2.3" targetFramework="net46" />
from nlog.config
<target name="rtb" xsi:type="RichTextBox" controlName="RichTextBox1" formName="NewForm"
useDefaultRowColoringRules="true" layout="[${date}] [${level:uppercase=true}] [${logger}] ${message}" />
...
<logger name="*" minlevel="Trace" writeTo="file,rtb" />
Adding internal logging didn't seem to give much more information:
...
...
2016-06-03 06:17:23.9385 Trace Scanning MessageLayoutRenderer 'Layout Renderer: ${message}'
2016-06-03 06:17:23.9550 Info Adding target File Target[file]
2016-06-03 06:17:23.9550 Debug Registering target file: NLog.Targets.FileTarget
2016-06-03 06:17:23.9550 Error Error in Parsing Configuration File. Exception: NLog.NLogConfigurationException: Exception occurred when loading configuration from C:\Users\Derek.Morin\Documents\Visual Studio 2010\Projects\ScriptCode\ScriptCode.ConvertedToC#\bin\x86\Debug\NLog.config ---> System.ArgumentException: Target cannot be found: 'RichTextBox'
at NLog.Config.Factory`2.CreateInstance(String name)
at NLog.Config.XmlLoggingConfiguration.ParseTargetsElement(NLogXmlElement targetsElement)
at NLog.Config.XmlLoggingConfiguration.ParseNLogElement(NLogXmlElement nlogElement, String filePath, Boolean autoReloadDefault)
at NLog.Config.XmlLoggingConfiguration.ParseTopLevel(NLogXmlElement content, String filePath, Boolean autoReloadDefault)
at NLog.Config.XmlLoggingConfiguration.Initialize(XmlReader reader, String fileName, Boolean ignoreErrors)
--- End of inner exception stack trace ---
2016-06-03 06:17:23.9700 Error Error has been raised. Exception: System.ArgumentException: Target cannot be found: 'RichTextBox'
at NLog.Config.Factory`2.CreateInstance(String name)
at NLog.Config.XmlLoggingConfiguration.ParseTargetsElement(NLogXmlElement targetsElement)
at NLog.Config.XmlLoggingConfiguration.ParseNLogElement(NLogXmlElement nlogElement, String filePath, Boolean autoReloadDefault)
at NLog.Config.XmlLoggingConfiguration.ParseTopLevel(NLogXmlElement content, String filePath, Boolean autoReloadDefault)
at NLog.Config.XmlLoggingConfiguration.Initialize(XmlReader reader, String fileName, Boolean ignoreErrors)
If I can't get an answer for how to get it working with the nlog.config file, at least I found the following workaround:
I adapted the answer from here: ( I didn't like the colouring choices )
Display NLog trace in RichTextBox
private void SetupRichTextBoxLogger()
{
NLog.Windows.Forms.RichTextBoxTarget target = new NLog.Windows.Forms.RichTextBoxTarget();
target.Name = "RichTextBox";
target.Layout = "${longdate} ${level:uppercase=true} ${logger} ${message}";
target.ControlName = nameof(this.RichTextBox1);
target.FormName = nameof(NewForm);
target.AutoScroll = true;
target.MaxLines = 0;
target.UseDefaultRowColoringRules = true;
AsyncTargetWrapper asyncWrapper = new AsyncTargetWrapper();
asyncWrapper.Name = "AsyncRichTextBox";
asyncWrapper.WrappedTarget = target;
SimpleConfigurator.ConfigureForTargetLogging( asyncWrapper, LogLevel.Trace );
}
Besides having the nuget-package NLog.Windows.Forms installed (Remember to use v4.6 or newer, together with NLog 5.0)
Then it is also recommended to update NLog.config to include NLog.Windows.Forms-assembly in <extensions>:
<?xml version="1.0" encoding="utf-8" ?>
<nlog>
<extensions>
<add assembly="NLog.Windows.Forms"/>
</extensions>
...
</nlog>
FWIW, I had this problem after upgrading to NLog 5 and removing the deprecated NLog.Config. Upon reverting to 4.7.15 with NLog.Config, the problem no longer occurred.
In my case, having NLog.Windows.Forms installed did not help.
I'm having trouble getting IIS 7 to load this handler I've written. I'm keeping things really simple to start with. I have a Handler.cs file with the following code in it:
public class Handler :IHttpHandler
{
public bool IsReusable
{
get { return false; }
}
public void ProcessRequest(HttpContext context)
{
context.Response.Write("asdfasdf");
}
}
I have put this file in the root directory.
I want to execute this code whenever the root directory receives a request, so I have built the handler file like this:
<configuration>
<system.webServer>
<handlers>
<add name="Handler" verb="*"
path="*.*"
type="Handler"
resourceType="Unspecified" />
</handlers>
</system.webServer>
</configuration>
IIS gives me the following error when I attempt to go to localhost/runt (my website root directory )
Server Error in '/' Application.
Could not load type 'Handler'.
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.Web.HttpException: Could not load type 'Handler'.
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:
[HttpException (0x80004005): Could not load type 'Handler'.]
System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +11247344
System.Web.Configuration.HandlerFactoryCache.GetHandlerType(String type) +23
System.Web.Configuration.HandlerFactoryCache..ctor(String type) +25
System.Web.HttpApplication.GetFactory(String type) +91
System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +338
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +263
Version Information: Microsoft .NET Framework Version:2.0.50727.5466; ASP.NET Version:2.0.50727.5459
Try setting the type to the fully qualified namesace.
You can find the default namespace through the properties of your web application.
<configuration>
<system.webServer>
<handlers>
<add name="Handler" verb="*"
path="*.*"
type="DefaultNamspaceFromProperties.ClassNamespace.Handler"
resourceType="Unspecified" />
</handlers>
</system.webServer>
</configuration>
I suspect that creating a default handler for everything using the .NET Framework will have some security risks and you should probably do further reading / consultation to make sure you aren't adversely putting your sites' security at risk.