Getting Event ID: 1023 and Event ID: 1009

Few days back I ran into an interesting problem. When we have a asp.net 1.1 application running on the server we might get the following event ids ocationally.

Event Type: Error
Event Source: .NET Runtime
Event Category: None
Event ID: 1023
Date: 02/18/07
Time: 3:58:41 AM
User: N/A
Computer: CompName
Description:
.NET Runtime version 2.0.50727.42 - Fatal Execution Engine Error (7A05E2B3) (80131506)

Event Type: Warning
Event Source: W3SVC
Event Category: None
Event ID: 1009
Date: 02/19/07
Time: 10:06:04 PM
User: N/A
Computer: CompName
Description:
A process serving application pool 'DefaultAppPool' terminated unexpectedly. The process id was ‘1234’. The process exit code was '0x80131506'.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

Event Type: Warning
Event Source: W3SVC
Event Category: None
Event ID: 1011
Date: 02/19/07
Time: 11:36:30 PM
User: N/A
Computer: CompName
Description:
A process serving application pool 'DefaultAppPool' suffered a fatal communication error with the World Wide Web Publishing Service. The process id was '1234'. The data field contains the error number.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Data:
0000: 6d 00 07 80 m..?

The interesting thing to note here is that the source of the event is .NET Runtime version 2.0.50727.42. Even though the application is made of 1.1 and there is no .net 2.0 applications are not running

Now the question is it being through by the .Net 1.1 web application and if yes how?

This kind of situation will come in case if we have an application that has both asp and asp.net 1.1 code in it. And the asp page making COM Interop calls. If the first request after recycling of the appPool ie w3wp is from an a asp page that making the COM interOp call then that will load the latest .net runtime present on the machine (if we don’t have any .net version greater than 1.1 installed on the machine then there no problem). Then when the actual call to the aspx page is made then will get this event as both 1.1 and 2.0 runtime cannot run in single appPool.

To get around this following approaches can be used

Approach 1: try to isolate the ASP and ASP.NET code in separate appPools

Approach 2: You can use an application configuration file to specify which versions of the .NET Framework an application or component supports. For more information on the same have a look at http://msdn2.microsoft.com/en-us/library/9w519wzk.aspx

http://msdn2.microsoft.com/en-us/library/w4atty68(vs.71).aspx

Approch 3 : Simplest solution is to add code to global.asa application start event that will run *before* the createObject in the .asp page. Something like:

<script language="vbscript" runat="server">

Sub Application_OnStart

dim xmlhttp
Set xmlhttp = Server.Createobject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "GET","http://localhost/mywebappurl/foo.aspx", false
xmlhttp.send()
Set xmlhttp = nothing

End Sub

</script>

Note that the URL must point to an app in the AppPool you're using but the foo.aspx page doesn't need to exist.

After running the application will have the IIS logs something like this. Note that will get one 404 corresponding to foo.aspx page and then the application would function as expected.

#Version: 1.0
#Date: 2007-03-01 00:02:30
#Fields: date time s-sitename s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status
2007-03-01 00:03:20 W3SVC1 127.0.0.1 GET /mywebappurl/foo.aspx - 80 - 127.0.0.1 Mozilla/4.0+(compatible;+Win32;+WinHttp.WinHttpRequest.5) 404 0 0
2007-03-01 00:03:20 W3SVC1 127.0.0.1 GET /test.asp - 80 - 127.0.0.1 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.2;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+InfoPath.2) 200 0 0
2007-03-01 00:04:01 W3SVC1 127.0.0.1 GET /test.asp - 80 - 127.0.0.1 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.2;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+InfoPath.2) 200 0 0