Welcome to TechNet Blogs Sign in | Join | Help

Sandy's Blog

I Think................ Therefore.......
Not able to open the BTS admin console.

hi Guys... Recently I worked with a customer where they weren’t able to open the BTS admin console. The BTS application as such works fine, when they open the MMC, it just hangs… nothing happens.. eventually they will get a timeout error message. From MBV we aren’t able to conclude as well.
Using DebigDiag tool (you can get the tool from the following location http://www.iis.net/downloads/default.aspx?tabid=34&g=6&i=1286), and here is what we found.


0:000> !clrstack
OS Thread Id: 0x3218 (0)
ESP EIP
0007e63c 7c8285ec [InlinedCallFrame: 0007e63c] <Module>.SNIReadSync(SNI_Conn*, SNI_Packet**, Int32)
0007e638 067e01e0 SNINativeMethodWrapper.SNIReadSync(System.Runtime.InteropServices.SafeHandle, IntPtr ByRef, Int32)
0007e6b0 049dfeb6 System.Data.SqlClient.TdsParserStateObject.ReadSni(System.Data.Common.DbAsyncResult, System.Data.SqlClient.TdsParserStateObject)
0007e6e8 049dfd10 System.Data.SqlClient.TdsParserStateObject.ReadPacket(Int32)
0007e6f4 067e294d System.Data.SqlClient.TdsParserStateObject.ReadBuffer()
0007e6fc 067e28c3 System.Data.SqlClient.TdsParserStateObject.ReadByte()
0007e704 067e1ef5 System.Data.SqlClient.TdsParser.Run(System.Data.SqlClient.RunBehavior, System.Data.SqlClient.SqlCommand, System.Data.SqlClient.SqlDataReader, System.Data.SqlClient.BulkCopySimpleResultSet, System.Data.SqlClient.TdsParserStateObject)
0007e750 067ee8b8 System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
0007e764 067ee7cf System.Data.SqlClient.SqlDataReader.get_MetaData()
0007e790 067ee448 System.Data.SqlClient.SqlCommand.FinishExecuteReader(System.Data.SqlClient.SqlDataReader, System.Data.SqlClient.RunBehavior, System.String)
0007e7c8 067e9ae6 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(System.Data.CommandBehavior, System.Data.SqlClient.RunBehavior, Boolean, Boolean)
0007e848 067e8be3 System.Data.SqlClient.SqlCommand.RunExecuteReader(System.Data.CommandBehavior, System.Data.SqlClient.RunBehavior, Boolean, System.String, System.Data.Common.DbAsyncResult)
0007e894 067e8a95 System.Data.SqlClient.SqlCommand.RunExecuteReader(System.Data.CommandBehavior, System.Data.SqlClient.RunBehavior, Boolean, System.String)
0007e8a4 067e87cc System.Data.SqlClient.SqlCommand.ExecuteReader(System.Data.CommandBehavior, System.String)
0007e8e0 067e874b System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(System.Data.CommandBehavior)
0007e8e4 067e8728 System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(System.Data.CommandBehavior)
0007e8e8 067e8584 System.Data.Common.DbDataAdapter.FillInternal(System.Data.DataSet, System.Data.DataTable[], Int32, Int32, System.String, System.Data.IDbCommand, System.Data.CommandBehavior)
0007e93c 067e83b2 System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable[], Int32, Int32, System.Data.IDbCommand, System.Data.CommandBehavior)
0007e97c 067e829a System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable)
0007e9b0 0634709c Microsoft.BizTalk.ExplorerOM.ReceivePort.SelectAll(Microsoft.BizTalk.ExplorerOM.IRootObject)
0007e9bc 06346eb3 Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer.get_ReceivePorts()
0007e9f0 06d0ca6c Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer.BuildApplicationCache()
0007ea1c 00386462 Microsoft.BizTalk.Administration.SnapIn.Nodes.ApplicationsFolder.Refresh()
0007ea48 06d09729 Microsoft.BizTalk.SnapIn.Framework.ScopeNode.Refresh(System.Type)
0007ea7c 06d095cf Microsoft.BizTalk.SnapIn.Framework.ScopeNode.RefreshChildren()
0007ea84 0640bb1e Microsoft.BizTalk.Administration.SnapIn.Nodes.GroupNode.RefreshNode()
0007eabc 0640ba2b Microsoft.BizTalk.Administration.SnapIn.Nodes.GroupNode.Refresh()
0007eaf4 00385a3d Microsoft.BizTalk.Administration.SnapIn.Nodes.GroupNode.OnRefresh()
0007eafc 00385a18 Microsoft.BizTalk.Administration.SnapIn.Nodes.GroupNode.OnRefresh(System.Object, Microsoft.BizTalk.SnapIn.Framework.ActionEventArgs)
0007eb2c 01fbba91 [MulticastFrame: 0007eb2c] System.EventHandler`1[[System.__Canon, mscorlib]].Invoke(System.Object, System.__Canon)
0007eb40 00385733 Microsoft.BizTalk.SnapIn.Framework.Action.OnTrigger(Microsoft.BizTalk.SnapIn.Framework.ActionEventArgs)
0007eb90 00385587 Microsoft.BizTalk.SnapIn.Framework.Action.ExecuteMain(Microsoft.BizTalk.SnapIn.Framework.ActionEventArgs)
0007eba0 003853fe Microsoft.BizTalk.SnapIn.Framework.Action.Execute(IntPtr, IntPtr)
0007ebbc 003852ab Microsoft.BizTalk.SnapIn.Framework.Node.Notify(UInt32, IntPtr, IntPtr)
0007ec04 0640769e Microsoft.BizTalk.SnapIn.Framework.Component.Notify(UInt32, IntPtr, IntPtr, System.String)
0007ed34 06406b1d Microsoft.BizTalk.SnapIn.Framework.Component.Notify(IntPtr, UInt32, IntPtr, IntPtr)
0007ef5c 79f047fd [GCFrame: 0007ef5c]
0007f0b8 79f047fd [ComMethodFrame: 0007f0b8]


From this we see that BizTalk is not able to connect to the SQL server for some reason.
Tested by creating a simple UDL file on Biztalk node and wasn’t able to connect to the database. We were getting a similar error message. Then it was found that there was a Named Pipes entered to the SQL DB on the BizTalk node after removing which we were able to access the admin console without any issues

 

Here are some of the articles related to Names pipes.

How to connect to a named instance of SQL Server 2005 or SQL Server 2000 by using the client tools in the earlier version of SQL Server
http://support.microsoft.com/kb/265808 

How to Disable Images from beeing downloaded into Temp internet folders while accessing a asp.net application

In this case the requirement was to disable images from getting downloaded to Temp internet folder (it was an asp.net application). This was a security requirement

 

in this case they were pulling the images from SQL and then using asp.net application to display the same after processing

 

By default IE will download the images to temp internet folders and display from there. It’s not possible to set the size of the temp internet folder to 0 as the minimum size is 8MB

 

When we set the "Expire Immediately" option for the HTTP HEADER tab of the site. The images stopped appearing in the temp internet folders. But, a aspx page corresponding html page will get downloaded to temp internet folder from where anyone can get to the images easily

 

When looked in fiddler trace we found that "Cache-Control" header was being sent as "private". This was being transmitted even if we explicitly set the header for "no-cache"

 

In this case we added the following code to global.asax and we got the expected behavior.

 

                                protected void Application_BeginRequest(Object sender, EventArgs e)

                                {

                                                Response.ClearHeaders();

                                                Response.AddHeader("Cache-Control", "no-cache");

                                } 

PS: if there is any custom header needed for the application then that needs to be handled as well.

 

Disclaimer: This is a personal weblog. The opinions expressed here represent my own and not those of my employer.

IIS worker process crashing repeatedly.

Some time back i worked on one of the issues where when users login to the server they get a prompt saying that the worker process terminated unexpectedly. In the Event logs we see the following event id's

In event logs we see the following event ids getting generated.
==============

Event Type: Warning
Event Source: W3SVC
Event Category: None
Event ID: 1009
Date:*******
Time: ********
User: N/A
Computer: ******
Description:
A process serving application pool "AppPoolName" terminated unexpectedly. The process id was 'PID'. The process exit code was '0xffffffff'.

Event Type: Information
Event Source: W3SVC
Event Category: None
Event ID: 1074                                        ------------------->       AppPool recycling
Date: ********
Time: ********
User: N/A
Computer: ******
Description:
A worker process with process id of 'PID' serving application pool "AppPoolName" has requested a recycle because the worker process reached its allowed processing time limit.

Event Type: Error
Event Source: Application Error
Event Category: None
Event ID: 1001
Date: ********
Time: ********
User: N/A
Computer: ******
Description:
Fault bucket 395446657.

Event Type: Information
Event Source: Application Error
Event Category: (100)
Event ID: 1004
Date: ********
Time: ********
User: N/A
Computer: ******
Description:
Reporting queued error: faulting application w3wp.exe, version 6.0.3790.3959, faulting module webengine.dll, version 2.0.50727.210, fault address 0x00002fe7.

Event Type: Error
Event Source: .NET Runtime 2.0 Error Reporting
Event Category: None
Event ID: 1000
Date: ********
Time: ********
User: N/A
Computer: ******
Description:
Faulting application w3wp.exe, version 6.0.3790.3959, stamp 45d6968e, faulting module webengine.dll, version 2.0.50727.210, stamp 45072279, debug? 0, fault address 0x00002fe7.

Event Type: Warning
Event Source: W3SVC
Event Category: None
Event ID: 1009
Date: ********
Time: ********
User: N/A
Computer: ******
Description:
A process serving application pool "AppPoolName" terminated unexpectedly. The process id was 'PID'. The process exit code was '0xc0000005'.
 

When we look at the crash dump we see the following error.

===============================================

0:036>
Error code: (Win32) 0x3e3 (995) - The I/O operation has been aborted because of either a thread exit or an application request.

From the event log we see that the crash is happening (event id 1009) when the appPool is getting recycled (event id 1074)


Resolution
===============
Please check the following article and follow the steps acccordingly
An IIS 6.0 application pool may unexpectedly exit when a worker process shuts down or is recycled
http://support.microsoft.com/?id=918041

Disclaimer: This is a personal weblog. The opinions expressed here represent my own and not those of my employer.

 

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

Sharing Forms Cookie between asp.net web applications

Hi Guys,

This is my first blog and I was a bit confused so as from where to start. Few days back I came across requirement of a customer who wanted to share forms authentication across two different applications. We have one asp.net 2.0 application and that has a link to another 2.0 application. Whenever a user clicks on the link he expects to be taken to the second application. But when the users click’s on the link what do we see……….? Users are getting one more prompt for getting access to the second application. Important thing to note here is that the we are suppose to get this prompt as the second application doesn’t have any knowledge of the cookie that has issued to the first application and hence the prompt. Is now the question is that is it really possible to achieve this requirement?

The Answer is yes. But we have to do few changes to the web.config for the applications so that both the applications understand the cookie and then we won’t get the prompt.

First step is to make sure that the “loginUrl” web.config of the second application points to the loginUrl of the first application as shown below.

 

<configuration>

  <system.web>

    <authentication mode="Forms" >

      <! -- The name, protection, and path attributes must match exactly in each Web.config file. -->

      <forms loginUrl="../form1/MyLoginPage.aspx"

      name=".ASPXFORMSAUTH"

      protection="All" 

      path="/"

      timeout="30" />

    </authentication>

 

    <!-- Validation and decryption keys must exactly match and cannot be set to "AutoGenerate". The validation and decryption algorithms must also be the same. -->

 

 <machineKey

validationKey="C50B3C89CB21F4F1422FF158A5B42D0E8DB8CB5CDA1742572A487D9401E3400267682B202B746511891C1BAF47F8D25C07F6C39A104696DB51F17C529AD3CABE"

decryptionKey="8A9BE8FD67AF6979E7D20198CFEA50DD3D3799C77AF2B72F"

validation="SHA1" />

  </system.web>

</configuration>

 

Unless otherwise noted, the name, protection, path attributes must be identical across all applications. Similarly, the encryption and validation keys and the encryption scheme and validation scheme used for cookie data must be exactly the same. If the settings do not match, cookies cannot be shared.

 To Generate the machine keys follow the steps mentioned below.

Create the project

Create a Visual C# .NET console application:

1.

Start Visual Studio .NET.

2.

On File menu, point to New, and then click Project.

3.

Under Project Types, click Visual C# Projects.

4.

Under Templates, click Console application.

5.

Name the project HashConfigCs.

6.

Click OK.

 

Write the code to generate the keys

 

The following code reads two arguments that are passed from the command line: • The first argument is the number of bytes that is used to create the decryptionKey attribute. 

• The second argument is the number of bytes that is used to create the validationKey attribute. 

The code uses a random number generator to create a random number of bytes based on the command-line arguments. After the random bytes are created, the bytes are formatted into a hexadecimal string that is suitable for use in the .config files.

 

The hexadecimal string that is created is twice the size of the value that is passed on the command line..

 

Add the following code to a .cs file: using System;

 

using System.Text;

using System.Security.Cryptography;

 

namespace Crypto

{

    public class KeyCreator

    {

        public static void Main(String[] args)

        {                          

            String[] commandLineArgs = System.Environment.GetCommandLineArgs();

            string decryptionKey = CreateKey(System.Convert.ToInt32(commandLineArgs[1]));

            string validationKey = CreateKey(System.Convert.ToInt32(commandLineArgs[2]));

 

            Console.WriteLine("<machineKey validationKey=\"{0}\" decryptionKey=\"{1}\" validation=\"SHA1\"/>", validationKey, decryptionKey);

        }  

 

        static String CreateKey(int numBytes)

        {

            RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();

            byte[] buff = new byte[numBytes];

 

            rng.GetBytes(buff);

            return BytesToHexString(buff);

        }

 

        static String BytesToHexString(byte[] bytes)

        {

            StringBuilder hexString = new StringBuilder(64);

 

            for (int counter = 0; counter < bytes.Length; counter++)

            {

                hexString.Append(String.Format("{0:X2}", bytes[counter]));

            }

            return hexString.ToString();

        }

    }

}

 

Generate the hashes

 

Now you can compile the application.

 

Run the application from a command prompt by passing in two integer values that are the size of the decryption and the validation keys. For example, if you named the console application HashConfigCs.exe, type the following syntax from the command line in the Bin\debug directory of the application:

 

hashconfigcs.exe 24 64

 

You can expect the application to return output that is similar to the following output:

 

<machineKey validationKey="21F090935F6E49C2C797F69BBAAD8402ABD2EE0B667A8B44EA7DD4374267A75D7AD972A119482D15A4127461DB1DC347C1A63AE5F1CCFAACFF1B72A7F0A281B"

            decryptionKey="261F793EB53B761503AC445E0CA28DA44AA9B3CF06263B77"

            validation="SHA1"/>

Then try the link and boom… it works J

Hope this helps in case of similar requirements.

Who Am I

Hi Guys

My name is Sandeep and I am working at Microsoft as an Developer Support Engineer since Oct. 2004. I learn new stuffs almost everyday and I would key in my knowledge on ASP.NET technology. I welcome all your comments, questions and suggestions.

Thanks :-)

Sandy

Page view tracker