Welcome to MSDN Blogs Sign in | Join | Help

 

Symptom

 

When start World Wide Web Publishing Service service, the following Service error message popup

 

Could not start the World Wide Web Publishing Service service on Local Computer.

Error 87: The parameter is incorrect.

 

In the system log, Event 7000 was logged:

 

Event Type:   Error

Event Source: Service Control Manager

Event Category:       None

Event ID:       7000

Date:            11/26/2009

Time:            3:49:37 PM

User:            N/A

Computer:     XXXXX

Description:

The World Wide Web Publishing Service service failed to start due to the following error:

The parameter is incorrect.

 

Troubleshooting

 

Run net start command, still get the same issue:

 

net start w3svc

 

Run the Process Monitor log, we found there is no service command to start executing the World Wide Web Publishing Service (i.e. C:\WINDOWS\System32\svchost.exe -k iissvcs)

 

Events should be similar with below when starting W3SVC on good IIS box.

 

12:26:26.6020853 PM             1040        services.exe           400          Process Create                C:\WINDOWS\System32\svchost.exe   SUCCESS               PID: 10692, Command line: C:\WINDOWS\System32\svchost.exe -k iissvcs

12:26:26.6020970 PM             1041        svchost.exe            10692      Process Start                          SUCCESS                Parent PID: 400

12:26:26.6021233 PM             1042        svchost.exe            10692      Thread Create                        SUCCESS                Thread ID: 11680

 

Hence, the issue can be caused by register key since the system service needs to get related information from service register value first.

 

Root Cause

 

We found extra Environment value under the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\, as below:

Windows Registry Editor Version 5.00

 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC]

….

"Environment"=hex(7):00,00

 

Data of Environment value is empty.

 

We have reviewed OS source code, when system starts service, the environment value will be read by service if exists and merge into parent’s Environment value. If there is no environment value, the value will be inherited from parent node.  Then it is used by service starting procedure.

 

The issue can be reproduced after add Environment Multi-String Value with empty data under the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\

 

Solution

Delete the Environment value under the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\
Successfully start the
World Wide Web Publishing Service.

 

 

Enjoy!

 

Anik Shen

 

 

This job is done by the cooperation between the front end BizTalk host instance process and the backend BizTalk SQL job MessageBox_DeadProcesses_Cleanup_BizTalkMsgBoxDb.  

1.       When a BizTalk host instance is started, it will call the store procedure bts_ProcessHeartbeat_<HostName> once as the below.

 

exec [dbo].[bts_ProcessHeartbeat_<HostName>] @uidProcessID=NULL,@dwCommand=1,@nHeartbeatInterval=60

 

Here @dwCommand=1 means Process Startup.

 

2.       When a BizTalk host instance is stopped, it will call the same store procedure bts_ProcessHeartbeat_<HostName> once again as the below.

 

exec [dbo].[bts_ProcessHeartbeat_<HostName>] @uidProcessID=NULL,@dwCommand=2,@nHeartbeatInterval=60

 

Here @dwCommand=2 means Process Shutdown.

 

3.       Look at the code of the store procedure bts_ProcessHeartbeat_<HostName>, could see the int_ProcessCleanup_<HostName> will be called if dwCommand=1(Process Startup) or dwCommand=2(Process Shutdown). The store procedure int_ProcessCleanup_<HostName> is used internally to clean up the records related with the host instance process and release all messages and service instances which are locked by this process.

 

4.       It is easy to understand why int_ProcessCleanup_<HostName> is called when a host instance is shutdown, the messages and service instances locked by the host instance can be freed before the shutdown so they can be picked up by the same restarted host instance again or they can be picked up by other host instances which are still running in a multiple boxes BizTalk environment.

 

5.       The questions is why int_ProcessCleanup_<HostName> is also called when a host instance is startup if the locked messages and services instances were already freed by the same SP when shutdown? Yes, it is redundant if the same SP was already called when the instance shutdown normally, but the problem is that the process could be terminated or crashed unexpectedly without calling the SP, You can see that abnormal shutdown easily by killing a host process, the SP bts_ProcessHeartbeat_<HostName> with the dwCommand=2 is not called if the host process is killed by the command “kill /f”. As we can’t guarantee the internal cleanup SP is already called before the host instance is started, to call the internal cleanup SP again at the startup is the good choice although it is redundant some times.

 

Another question is raised at this point, if a host instance process is totally hang or dead there, or it is just crashed or terminated unexpectedly without restarting, who can help to detect the situation and release these locked messages and service instances? How? Let’s continue.

 

6.       In each running BizTalk host instance, you can see one thread as the below.

 

0:016> kc

 

ntdll!NtWaitForSingleObject

kernel32!WaitForSingleObjectEx

kernel32!WaitForSingleObject

BTSMessageAgent!CAdminCacheRefresh::OnCall

BTSMessageAgent!CThreadPoolWrapper::ThreadWorker

ntdll!RtlpWorkerCallout

ntdll!RtlpExecuteWorkerRequest

ntdll!RtlpApcCallout

ntdll!RtlpWorkerThread

kernel32!BaseThreadStart

 

7. The thread calls the store procedure bts_ProcessHeartbeat_<HostName>  with @dwCommand=0 every 60 seconds by default. The interval can be modified through the column ConfigurationCacheRefreshInterval of the table adm_Group in BizTalkMGMTDb or through the settings of the BizTalk group in BizTalk admin UI.

 

exec [dbo].[bts_ProcessHeartbeat_Newhost] @uidProcessID=NULL,@dwCommand=0,@nHeartbeatInterval=60

 

Here @dwCommand=0 means Process Live.

 

8. Look at the code of the store procedure bts_ProcessHeartbeat_<HostName>, the internal SP int_ProcessCleanup_<HostName> will not be called if dwCommand=0(Process Live). The bts_ProcessHeartbeat_<HostName> will only update a record or insert a new record if there is no existing one in the table ProcessHeartbeats in BizTalkMsgBoxDb for the host instance.

 

9. Let’s look at the record in the table ProcessHeartbeats and see what it is look like.

 

uidProcessID

nvcApplicatioName

dtCreationTime

dtLastHeartbeatTime

dtLastHeartbeatTime

4d50992e-2ae1-4bbd-9d61-b712b052b99c

BizTalkServerApplication

11/25/2009 4:52:44 AM

11/25/2009 4:52:44 AM

11/25/2009 5:02:44 AM

uidProcessID is the unique GUID for each host instance. You can get the uidProcessID for a host instance by query the UniqueId column of the table adm_HostInstance in BizTalkMGMTDb. You also can get the uidProcessID for a host instance by checking the service property “Path to Executable” of the corresponding BizTalk service in Windows Service Control Manager on a BizTalk box. For example, the following is the “Path to Executable” setting for my "BizTalkServerApplication" in my BizTalk testing box. You can see the ID is after the command line option “-btsapp”.

 

"C:\Program Files (x86)\Microsoft BizTalk Server 2006\BTSNTSvc.exe" -group "BizTalk Group" -name "BizTalkServerApplication" -btsapp "{4D50992E-2AE1-4BBD-9D61-B712B052B99C}"

 

You can note that the dtNextHeartbeatTime is about equal to (dtLastHeartbeatTime+10*HeartbeatInterval). Since the default HeartbeatInterval is about 60 seconds by default(we mentioned how to modify that interval at the above), the dtNextHeartbeatTime is about 10 minutes after the dtLastHeartbeatTime by default. Of course if the HeartbeatInterval is modified to 30 seconds, then the dtNextHeartbeatTime would be 5 minutes after the dtLastHeartbeatTime.

 

10. Normally the record for a specified host instance in the table ProcessHeartbeat is updated every [HeartbeatInterval] seconds through the SP bts_ProcessHeartbeat_<HostName> by the running host instance process.

 

11. Take a look at the SQL job MessageBox_DeadProcesses_Cleanup_BizTalkMsgBoxDb, it is configured to execute the store procedure bts_CleanupDeadProcesses every minute.

 

12. Look at the code of the SP bts_CleanupDeadProcesses, it is simply go through the table ProcessHeartbeats and check if there is a host instance which dtNextHeartbeatTime is older than the current time. If there is, which means we already lost 10 heartbeats at least from this host instance, this host instance is then considered as dead and the store procedure int_ProcessCleanup_<HostName> for that instance is called by the SQL job to clean up the records related with the host instance process and release all messages and service instances which are locked by the process.

 

If this SQL job is disabled or get a problem when it is running, BizTalk will lost the capability to detect “dead” of a host instance.

 

Regards,

 

XiaoDong Zhu

 

 

 

 

Symptom

 

When try to suspend or terminate a active service instance, the instance can not be suspended or terminated for a long time, it keeps active with Pending Job of the instance is set to Suspend or Terminate

 

Analysis

 

A service instance is in Active status means that it is still actively running in a host instance and hasn’t reached the next persistence point. Suspend and Terminate operations are designed as operation which will only be executed at the next persistable point. The Suspend or Terminate operation will be put into the pending operation table when the target service instance is in Active status. Please note BizTalk only hold one pending operation for a single instance. The instance will keep Active status with the queued pending operation until the next persistence point is reached. Let’s use a simple orchestration example to demo the behavior.

biztalk1.JPG

biztalk2.jpg

 

The code is in Expression_1 is as the below which is used to simulate long time processing in a host instance or hang in a host instance.

 

System.Threading.Thread.Sleep(5*60000);

 

When drop a testing message to activate the above simple orchestration, it will keep Active status for about 5 minutes and then an output message will be sent out. If try to suspend the active instance when the instance is sleeping in the host instance,  the instance will keep in Active status for a quite while with Pending Job is set to Suspend until the next persistence point - send shape is reached. One interesting thing is that the orchestration instance will be started from the last persistence point to continue the execution if the running host instance is restarted, our simple orchestration will start from the beginning to re-execute the whole orchestration code again if the host instance is restarted during System.Threading.Thread.Sleep(),we will see the instance will keep Active status with the pending operation Suspend for another 5 minutes. Now we got a problem, If the code in the expression shape is changed as the below to simulate a real hang situation.

 

while(1==1){System.Threading.Thread.Sleep(5*60000);}

 

We will find we can’t suspend the Active instance. The orchestration instance will keep Active with the pending operation Suspend forever even if the running host instance is restarted in BTS 2K6 and 2K6R2.

 

The ways to handle a long time active or hang instance as the above

 

1.  The format way should be to find where is the instance active or hang. The HAT debugging or a hang dump file for the running host instance can be used to find out where the instance processing is blocked. If the processing block or the hang can be fixed, then the instance can quickly move to the next persistable point, the pending operation or the other operations can get a chance to execute.

 

2. If you don’t want to spend the time to figure out where the blocking is and just want to simply clean out the instance from the MessageBox, use the tool Terminator to terminate these instance hardly. You can download the Terminator from the below link. The following is the captured screen for Terminate Instance (Hard) for the reference.

 

http://blogs.msdn.com/biztalkcpr/pages/biztalk-terminator-download-install-info.aspx

biztalk3.JPG

3. As the above, if just want to suspend or terminate the instance, besides the Terminator, you also can call the internal store procedure int_AdminSuspendInstance_<host> or int_AdminTerminateInstance_<host> directly to suspend or terminate the instance in MessageBox database. The following are the two SQL script sample to use the two store procedures.

 

Hard Suspend:

 

declare @ApplicationName nvarchar(128)

declare @uidInstanceID uniqueidentifier

declare @uidServiceID uniqueidentifier

declare @fKnownInstance int

declare @nvcErrorString nvarchar(512)

declare @dtTimeStamp datetime

declare @spname nvarchar(512)

Begin Tran

set @ApplicationName='testhost'

set @uidInstanceID='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'

set @uidServiceID='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'

set @dtTimeStamp=GETUTCDATE()

select @nvcErrorString = nvcError FROM dbo.LocalizedErrorStrings WHERE nID = 4

set @spname= 'int_AdminSuspendInstance_' + @ApplicationName

exec @spname @uidInstanceID, @uidServiceID, N'0xC0C01B50', -1, @nvcErrorString, 1, null, @dtTimeStamp, null, null, @fKnownInstance OUTPUT

DELETE FROM InstancesPendingOperations WITH (ROWLOCK) WHERE uidInstanceID = @uidInstanceID OPTION (KEEPFIXED PLAN)

Commit Tran

 

Hard Terminate:

 

declare @ApplicationName nvarchar(128)

declare @uidInstanceID uniqueidentifier

declare @uidServiceID uniqueidentifier

declare @fKnownInstance int

declare @spname nvarchar(512)

Begin Tran

set @ApplicationName='testhost'

set @uidInstanceID=' xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx '

set @uidServiceID=' xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx '

set @spname= 'int_AdminTerminateInstance_' + @ApplicationName

exec @spname @uidInstanceID, @uidServiceID, @fKnownInstance OUTPUT

DELETE FROM InstancesPendingOperations WITH (ROWLOCK) WHERE uidInstanceID = @uidInstanceID OPTION (KEEPFIXED PLAN)

Commit Tran

 

*note*    

(1) The two store procedures are used by BizTalk internally to suspend or terminate an instance, the implementation and the SP interface could be changed in future. The above sample scripts are based on BTS2K6 and BTS2K6R2

(2) You must modify the script to provide the BizTalk Host name, the uidInstanceID and uidServiceID of the target service instance to the variables @ApplicationName, @uidInstanceID and @uidServiceID before execute the script.

(3) Stop the running host instance before execute the script in order to avoid any inconsistence error between the status of the running instance in the host process memory and the status of the instance persisted in the database.

*note* In multiple boxes BizTalk environment, the host instance which an active instance is running in can be found by looking “Processing Server” and “Host” columns of the service instance in BizTalk admin console. The columns for “Processing Server” and “Host” are not listed in the BizTalk group hub UI by default and they can be added manually.

(4) As you can see in Terminator when use Terminate Instance (Hard), the above script should also be used as a last resort. You should be very clear what you want to do and what the impact could be in business before decide to use the script.

 

4. In BTS2K6 R2 + KB969987 (http://support.microsoft.com/kb/969987) and BTS2K9, it is easier to terminate or suspend such active instance. If you see the instance keep Active with the Pending Operation set after terminate or suspend an active instance in BTS2K6 R2 + KB968897 and BTS2K9, simply restart the host instance which the target service instance is running with, you will see the Pending operation(Terminate or Suspend) got executed immediately after the host instance is restarted. This is because that when a host instance is restarted in BTS2K6 R2 + KB969987 or in BTS2K9, it will check if there is a Pending Operation for every service instance which was owned by this host instance previously, the Pending Operation for an instance will get executed immediately if it is found.

 

Regards,

 

XiaoDong Zhu

 

 

 

Symptom:

==========

 

You may see the following warning event in a BizTalk machine.

 

Event Type: Warning

Event Source: ENTSSO

Event ID: 10536

Description:

SSO AUDIT

Function: GetConfigInfo

Tracking ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Client Computer: xxx.xxx.xxx (BTSNTSvc.exe:1234) Client User: Domain\BizAdmin Application Name: { xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx } Error Code: 0x800706D9, There are no more endpoints available from the endpoint mapper.

 

If try to backup the master secret on the SSO master secret cluster, you can get the below error:

 

C:\Program Files\Common Files\Enterprise Single Sign-On>ssoconfig -backupsecret test.bak
Password : *******
Confirm Password : *******
Password reminder : 1234567
ERROR: 0xC0002A0F : Could not contact the SSO server 'sso-cluster'. Check that SSO is configured and that the SSO service is running on that server.
(RPC: 0x800706D9: There are no more endpoints available from the endpoint mapper.)

 

Cause:

===========

In the SSO master secret cluster environment, the RPC service “SSOSecretServer” will not be registered successfully in the RPC endpoint mapper if the local ENTSSO service is started on a node before the clustered ENTSSO resource is brought online on this node.

 

For example, someone starts the local ENTSSO service from the service control manager or some tool executes a command “net start ENTSSO” on a cluster node.

 

In our case, we find there is a monitoring tool which periodically starts the local ENTSSO service on both cluster nodes if it finds they are not started, then the error will be reported when the cluster ENTSSO failover to another node which the local ENTSSO service is already started. Using “rpcdump” utility (the command “rpcdump -s <sso-cluster> -i”) or “portqry” utility (the command “portqry -n <sso-cluster> -e 135”) could list the registered RPC services in a RPC endpoint mapper. In this case, we only see the SSO related RPC services SSOMappingServer,SSOAdminServer,SSOLookupServer,SSOCSServer were registered but SSOSecretServer.

 

Solution:

=========

Stop the local ENTSSO service on another node and failover the cluster SSO to the node.

Configure the monitoring tool and stop to start the local ENTSSO service on both cluster nodes.

 

Regards,

 

XiaoDong Zhu

 

Symptom:

When we use svcutil.exe to generate the proxy class or configuration file through retrieving published WCF service metadata, or we add service reference in IDE to reference to a WCF service, we may receive below error message.

“There is an error in the XML document.
The maximum nametable character count quota (16384) has been exceeded while reading XML data. The nametable is a data structure used to store strings encountered during XML processing - long XML documents with non-repeating element names, attribute names and attribute values may trigger this quota. This quota may be increased by changing the MaxNameTableCharCount property on the XmlDictionaryReaderQuotas object used when creating the XML reader.
If the service is defined in the current solution, try building the solution and adding the service reference again”

For example, suppose you have published a WCF service endpoint with net.tcp binding which metadata endpoint is deployed as follows:
net.tcp://WCFServer:88/yourService/MEX/

Then you use svcutil.exe to generate the proxy class and configuration file as follows:
Svcutil.exe net.tcp://WCFServer:88/yourService/mex/ /config:app.config /out:proxyclass.cs

You may receive above error message.

Root Cause & Solution:
When WCF client  retrieves the large service metadata to generate client proxy class, the threashold about MaxNameTableCharCount of XmlDictionaryReaderQuotas object which is 16384 bytes is trigged when processing the large metadata XML file, just as described in the error message.

In order to customize this threshold, we need to configure a configuration file manually to reset value of MaxNameTableCharCount for the WCF metadata retrieving tool, such as svcuti.exe, or IDE. That is to say,
     a)   For svcutil.exe, we need to create a corresponding configuration file called svcutil.exe.config ;

 b)   For Visual Studio2008, we need to create a corresponding configuration called devenv.exe.config.

Then add correct configuration section to the corresponding file and restart the tool.

a)       if your MEX endpoint is published with net.tcp binding, we could configure the endpoint with net.tcp binding as follows:

<?xml version="1.0" encoding="utf-8"?>

<configuration>

  <system.serviceModel>

    <client>

      <endpoint name="net.tcp" binding="netTcpBinding" bindingConfiguration="bc" contract="IMetadataExchange" />

    </client>

    <bindings>

      <netTcpBinding>

        <binding name="bc" maxReceivedMessageSize="512000">

          <readerQuotas maxNameTableCharCount="2147483647" />

          <security mode="None"/>

        </binding>

      </netTcpBinding>

    </bindings>

  </system.serviceModel>

</configuration>

 

b)      if your MEX endpoint is published with HTTP related binding, we could configure the endpoint with custom binding as follows:

<?xml version="1.0" encoding="utf-8"?>

<configuration>

  <system.serviceModel>

    <bindings>

      <customBinding>

        <binding name="MyBinding">

          <textMessageEncoding>

            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"

                maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />

          </textMessageEncoding>

          <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />

        </binding>

      </customBinding>

    </bindings>

    <client>

      <endpoint binding="customBinding" bindingConfiguration="MyBinding"

          contract="IMetadataExchange"

          name="http" />

    </client>

  </system.serviceModel>

</configuration>

References:
XmlDictionaryReaderQuotas
http://msdn.microsoft.com/en-us/library/aa702595.aspx

<readerQuotas>
http://msdn.microsoft.com/en-us/library/ms731325.aspx

Best Regards,

Winston He.

 

 

One customer has a DCOM application, which was developed by unmanaged C++. The client application is the managed code. When the client application is compiled as a Debug version, everything runs smoothly, however, after it runs as a Release version, an “RPC is Unavailable” happens always.

 

Analysis

==========

While we look at the issue, my first thought is that the DCOM server application crashes for some reason. We used debugging tool Adplus.vbs , and confirmed that the DCOM server application just exits normally without any exceptions.

 

In my opinion, another possible reason is that the DCOM objects has no references, then the DCOM server process quits accordingly by following its mechanism. For more regarding DCOM architecture and overview, please refer to:

 

DCOM Architecture

http://msdn.microsoft.com/en-us/library/ms809311.aspx

 

DCOM Technical Overview

http://msdn.microsoft.com/en-us/library/ms809340.aspx 

 

Why does the DCOM objects reference counter suddenly become Zero and why this only happens to Release mode?

 

We used the tttracer to capture the client application and DCOM server process. Found the client application hits the “RPC is unavailable” at this call stack:

 

0:001> !sos.clrstack

OS Thread Id: 0x55c (1)

ESP       EIP    

0012df48 79e7cc26 [GCFrame: 0012df48]

0012e150 79e7cc26 [GCFrame: 0012e150]

0012e35c 79e7cc26 [HelperMethodFrame_PROTECTOBJ: 0012e35c] System.RuntimeType.InvokeDispMethod(System.String, System.Reflection.BindingFlags, System.Object, System.Object[], Boolean[], Int32, System.String[])

0012e3e4 7928e3a2 System.RuntimeType.InvokeMember(System.String, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object, System.Object[], System.Reflection.ParameterModifier[], System.Globalization.CultureInfo, System.String[])

0012e530 0a4f6528 Mycomponent.UnisimMycomponent.AddStageDataWithLateBinding(System.Type, System.Object, System.Object)

0012e6bc 0a4f5ec0 Mycomponent.UnisimMycomponent.GetFlowDataWithLateBinding(System.Type, System.Object, Mycomponent.DataStructure.SimulationFile)

0012e71c 0a4f5af0 Mycomponent.UnisimMycomponent.GetSubFlowsWithLateBinding(System.Type, System.Object, System.Object, Mycomponent.DataStructure.SimulationFile, System.String)

0012e75c 0a4f5b26 Mycomponent.UnisimMycomponent.GetSubFlowsWithLateBinding(System.Type, System.Object, System.Object, Mycomponent.DataStructure.SimulationFile, System.String)

0012e79c 0a4f586a Mycomponent.UnisimMycomponent.AddUnisimSimFileWithLateBinding(Mycomponent.DataStructure.SimulationFile, System.String)

 

Based on the call stack, we double checked the related code, it is like this:

 

       object realVar = mytype.InvokeMember("myPropertyA", BindingFlags.GetProperty, null, stage, null);

        double val = (double) mytype.InvokeMember("GetValue", BindingFlags.InvokeMethod, null, realVar, null);

 

The problem turns out to be a managed object that holds a pointer to an unmanged object and making a p/invoke with no further references to the object, after the p/invoke is garbage collected before the p/invoke is finished. In this case, because objects have not been referenced any more at this moment due to garbage collection in managed client application, then the DCOM server exited “smoothly”. Finally the “RPC is unavailable” error happens.

 

How to keep the unmanaged object reference while calling unmanaged object through P/Invoke, so that DCOM server process will not exit unexpectedly? The answer is we can use GC.KeepAlive().

 

The purpose of the KeepAlive method is to ensure the existence of a reference to an object that is at risk of being prematurely reclaimed by the garbage collector. A common scenario where this might happen is when there are no references to the object in managed code or data, but the object is still in use in unmanaged code such as Win32 APIs, unmanaged DLLs, or methods using COM.

 

The important thing is to code this KeepAlive method at the end, not the beginning, of the range of instructions where obj must be available.

 

Refer to:

http://msdn.microsoft.com/en-us/library/system.gc.keepalive.aspx

 

So why in debug mode we didn’t experience this issue? Chris’ blog has mentioned this point:

 

However if you compile the code in debug mode, the JIT will extend lifetimes of references to the end of their enclosing method.  In this case, KeepAlive actually isn’t necessary.  But in the release case, a reference should be live until the last line of code that references it.

 

Refer to:

http://blogs.msdn.com/clyon/archive/2006/08/28/728688.aspx

 

After customer followed the guideline to use KeepAlive, the application works well in Release Mode now.

 

Best Regards,


Freist Li

 

If you follow the instructions in the article KB954822, you may find the web sites are still not indexed.

 

 

We can use the following steps:

 

Install IIS 6 Management Compatibility

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

 

1.            Click Start , point to All Programs , point to Administrative Tools , and then click Server Manager .

2.            In the console tree of Server Manager, Expand Roles , and then right click Web Server(IIS). Click Add Role Services

3.            In the Add Role Services Wizard, select IIS 6 Management Compatibility, and then click Next .

4.            Follow the instructions in the Add Role Services Wizard to complete the installation.

 

Select the web site you want to search

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

 

1.       In Indexing MMC right click your catalog and choose Properties.

2.       Click Tracking tab.

3.       Select the web site in “WWW Server” dropdown list.

4.       Then click OK.

5.       If you open the property page again, you will see that “WWW Server” field is still empty. But it is just a UI issue.

6.       To verify whether you select the web site, please check the following values under the registry: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ContentIndex\Catalogs\[Catalog Name]

IsIndexingW3Svc

W3SvcInstance

                               

Make sure the value IsIndexingW3Svc is 1 and the value of W3SvcInstance is your selected web site instance.

 

Set ContentIndexed metabase property

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

 

In Windows 2003 you can select the option “Index this resource” on the virtual directory if you want to index some web pages. But in Windows 2008 there is no administrative UI for you to enable this option. We have to use command line scripts:

1.       Open a command prompt and change the current directory to %systemdrive%\inetpub\adminscripts.

2.       Run the command: cscript adsutil.vbs set w3svc/[web site instance]/root/[virtual director]/ContentIndexed 1

 

For example, if you want to enable “Index this resource” on the virtual directory MyVIR of the default web site, you can run: cscript adsutil.vbs set w3svc/1/root/MyVIR/ContentIndexed 1

 

After you enable the above options, you can restart your indexing service. The indexing service will automatically check the IIS settings and generate the catalog.

 

Regards,

 

Xin Jin

 

 

 

Problem:

 

After recovering the BizTalk databases from a disaster in BTS2K6 R2 or after upgrade from BTS2K6 to BTS2K6 R2, the BizTalk service could fail to start and the following error is reported

 

Event Type: Error

Event Source: BizTalk Server 2006

Event Category: BizTalk Server 2006

Event ID: 5410

Description:

A failure occurred when executing a Windows service request.

 

 Service request: Start

 

 BizTalk host name: BizTalkServerApplication

 Windows service name: BTSSvc$ BizTalkServerApplication

 

 Additional error information:

 Error code: 0xc0c0153a

 Error source: BizTalk Server 2006

 Error description: A BizTalk subservice has failed while executing a service request.

 

 Subservice: Caching Service

 Service request: Start

 

 Additional error information:

 Error code: 0xc0c01b15

 Error source: 

 Error description: The configuration information for the running service could not be retrieved from the database.  Please check the installation.  

 

 

Cause:

 

In BTS2K6 R2 and BTS2K9, a database consistence checking will be done when a BizTalk service is started, BizTalkMgmtDb.adm_Group. SubscriptionDBServerName and BizTalkMgmtDb.adm_Group. SubscriptionDBName will be checked to see if they match with BizTalkMgmtDb.adm_MessageBox.DBServerName and BizTalkMgmtDb.adm_MessageBox.DBName for  the column BizTalkMgmtDb.adm_MessageBox.IsMasterMsgBox = ‘-1’, Please note this comparing is case sensitive. Normally this consistence checking should be fine as these entries in BizTalk management DB should be completely the same since they can only be entered once through the BizTalk Configuration wizard. However should you need to recover these databases from a disaster or should you upgrade from BTS2K6 to BTS2K6 R2, you could  manually enter the DB names of the BizTalk GROUP again, if the name was entered the same but in a different case (lower or upper) , the above problem should occur due to the consistence comparing failure.

Solution:

 

Manually update the BizTalkMgmtDb.adm_Group. SubscriptionDBServerName and BizTalkMgmtDb.adm_Group. SubscriptionDBName or BizTalkMgmtDb.adm_MessageBox.DBServerName and BizTalkMgmtDb.adm_MessageBox.DBName for  the column BizTalkMgmtDb.adm_MessageBox.IsMasterMsgBox = ‘-1’ and make they are  the  same in case sensitive.

 

Regards,

 

XiaoDong Zhu

 

 

In this document, I'd like to give you some brief ideas about how to configure MSDTC resource in Windows 2008 Failover cluster environment. I suppose you have successfully setup windows failover cluster. If you haven't, please refer to the following articles to setup.

 

http://www.mssqltips.com/tip.asp?tip=1687

http://www.mssqltips.com/tip.asp?tip=1698

 

Environment:    Windows 2008 SP2 Failover Cluster

Step 1: Make sure to add the DTC role

 

In "Server Manager", click "Add Role" to add DTC role. The screenshot is like below after finishing.

 

HOWTO_DTC_1.png

 

 

Step 2: Make sure to allow inbounds and outbounds in Firewall

1)      If the windows firewall is turned on, please make sure to enable all "Distributed Transaction Coordinator" related "Inbound Rules" and "Outbound Rules" in "Windows Firewall with Advanced Security" MMC, please refer to the picture.

HOWTO_DTC_9.png

2)      If there's some other firewall within your network, please refer http://support.microsoft.com/kb/250367 to make MSDTC work through the Firewall.

Step 3: Create MSDTC resource

1)      Open the Failover Cluster Management console on any of the cluster node.

2)      Under the cluster name, right-click on Server and Applications and select Configure a Service or Application. This will run the High Availability Wizard 

HOWTO_DTC_2.png

2)  In the Select Service or Application dialog box, select Distributed Transaction Coordinator (DTC) and click Next.

HOWTO_DTC_3.png

4)   In the Client Access Point dialog box, enter the name and IP address of the clustered MSDTC. This should be a different IP addresses and host name from the one that the Windows Server 2008 cluster is already using. Click Next.

HOWTO_DTC_4.png

5) In the Select Storage dialog box, select the disk subsystem that will be used by MSDTC. These disk subsystems have to be defined as available storage in your cluster. Click Next

HOWTO_DTC_5.png

6)      In the Confirmation dialog box, validate the configuration you have selected for MSDTC and click Next

7)      In the Summary dialog box, click Close. This completes the installation of MSDTC on the cluster.

8)      You can validate your installation of MSDTC by expanding the Services and Applications node and check the cluster name of MSDTC.  Make sure that all of the dependency resources are online

HOWTO_DTC_6.png

Step 4: Enable Network Access for MSDTC resource

1)      Open "Component Services" MMC, right click "My Computer" and select "Properties", on the "MSDTC" tab, we can find the MSDTC resource which we created in the previous step is the "Default Coordinator" now. In this situation, all the transactions will be handled by this MSDTC resource.

HOWTO_DTC_7.png

2)  Expand My Computer->Distributed Transaction Coordinator->Clustered DTCs, right click our MSDTC resource(SQL2K8-CLUSDTC) and select Properties.

HOWTO_DTC_8.png

3) On the Security tab, check "Network DTC Access", "Allow Inbound", "Allow Outbound", "Incoming Caller Authentication Required", then click OK.

HOWTO_DTC_10.png

 

Now you can run the DTCTester tool from a client machine to do testing if you installed SQL Server Failover on this cluster. Please pay attention that all the services will use this MSDTC resource to coordinate with other DTC as we only have one MSDTC resource. We can also configure a private MSDTC resource for the SQL Server instance, please refer to  http://beta.blogs.msdn.com/asiatech/archive/2009/10/29/how-to-configure-msdtc-resource-for-sql-server-2008-failover-cluster.aspx

Of course we can also map a MSDTC resource to a specific service, please refer to http://technet.microsoft.com/en-us/library/cc742483(WS.10).aspx

References

Understanding MS DTC Resources in Windows Server 2008 Failover Clusters: http://msdn.microsoft.com/en-us/library/cc730992(WS.10).aspx

Enable Network Access Securely for MS DTC: http://technet.microsoft.com/en-us/library/cc753620(WS.10).aspx

 

Best Regards,

 

Zhixing Lv

 

 

3 steps:

 

1.       Install the fix http://support.microsoft.com/kb/948963 which will install the cipher sutes AES 128 and AES 256.

2.       The order of cipher suites on Windows 2003 is hard-coded. AES 128 is the highest priority. AES 256 is the next. We only need to disable AES 128 then AES 256 will have the highest priority.

a.       Open regedit.exe on IIS 6.0 machine.

b.      Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers. You should be able to find there are many subkeys, e.g.  AES 128/128.

c.       In subkey AES 128/128, create a DWORD value “Enabled”. Set it as the value 0. It means we would disable AES 128.

3.       Reboot the IIS 6.0 machine.

 

On Vista/Windows7 which support AES 256 machine, you can use IE to browse that IIS 6.0 web site through HTTPS. The SSL uses 256 bit encryption.

 

Regards,

 

Xin Jin

 

 

The problem customer experienced is IIS compression doesn’t work after configured compression for static files. The same setting works with DEV environment.

 

We checked everything about compression related settings and no problem found. Then we collected a hang dump for w3wp.exe, and found HTTP compression failed to initialize.

-          There is no HTTP compression thread

-          HTTP compression initialization status is COMP_INIT_NONE, the correct one should be COMP_INIT_DONE.

000007ff`5e552d1c w3core!HTTP_COMPRESSION::sm_InitStatus = COMP_INIT_NONE (0)

 

We did some simple test and found HTTP compression works if Network Service was used as the application pool’s identity but failed with a customized identity. We compared the permissions and privileges between Network Service and this customized identity, no differences found.

 

Then, we attached a debugger and broke at the HTTP compression initialization function “w3core!HTTP_COMPRESSION::Initialize”. A “access denied” error was occurred when try to read the compression metabase(“/LM/W3SVC/Filters/Compression”).

 

HTTP compression starts working after grant IIS_WPG group read permission for “/LM/W3SVC/Filters/”. By default, IIS_WPG group has read and write permission for “/LM/W3SVC/Filters/” and its child nodes.

 

326902  ACLs and using MetaACL for metabase ACL permission changes

http://support.microsoft.com/default.aspx?scid=kb;EN-US;326902

 

See you next time,

Zhao Wei

 

 

In the Windows 2008 Failover Cluster environment, we recommend the "Incoming Caller Authentication Required" security setting for the MSDTC service. I'll describe how to create the private MSDTC cluster resource for the SQL instance.

Environment: Windows 2008 SP2 Failover Cluster

SQL Server 2008

Step 1: Install the SQL Server cluster

Since this step is not the main purpose of this document, so I won't give you the detailed information of this topic. Please refer to the following documents to install SQL Server Cluster.

http://download.microsoft.com/download/6/9/D/69D1FEA7-5B42-437A-B3BA-A4AD13E34EF6/SQLServer2008FailoverCluster.docx

http://www.mssqltips.com/tip.asp?tip=1687

Step 2: Create the MSDTC resource for the SQL instance

1.    In "Failover Cluster Management" MMC, right click the SQL instance and select Add a resource->More resources…->2-Add Distributed Transaction Coordinator

 

STEP1.jpg

2.    Then, the MSDTC resource will be listed in the same group. Please right click the MSDTC resource and select "Properties", then input the dependencies of Network name and disk.

 

STEP2.jpg

 

 

3.    Bring this MSDTC resource online

 

4.    Open "Component Services" MMC, you can find this MSDTC instance on the left tree. Right click this MSDTC instance and select "Properties", then check the following items.

Network DTC Access

Allow Inbound

Allow Outbound

Incoming Caller Authentication Required

 

STEP4.jpg 

 

 

5.    Now, we need to change the Network resource name to the DNS name, otherwise the MSDTC runtime can't get the proper Network resource at runtime. After you install the SQL Cluster, the Resource Name could be "SQL Network Name(<DNS name>)", please refer to the following picture.

 

STEP5.jpg

 

To change the resource name, please run the following command:

Cluster.exe res "SQL Network Name (<DNS name>)" /ren:<DNS name>

For example, I need to run this command in my scenario: Cluster.exe res "SQL Network Name (sean-sl08)" /ren:sean-sl08

Now, your MSDTC resource can work properly. You can run the DTCTester tool to do testing.

References

Understanding MS DTC Resources in Windows Server 2008 Failover Clusters: http://msdn.microsoft.com/en-us/library/cc730992(WS.10).aspx

Enable Network Access Securely for MS DTC: http://technet.microsoft.com/en-us/library/cc753620(WS.10).aspx

How to Configure Multiple Instances of Distributed Transaction Coordinator (DTC) on a Windows Server Failover Cluster 2008: http://blogs.technet.com/askcore/archive/2009/02/18/how-to-configure-multiple-instances-of-distributed-transaction-coordinator-dtc-on-a-windows-server-failover-cluster-2008.aspx

Regards,

 

ZhiXing Lv

 

 

IIS 7.0 provides the FREB method to get verbose requests handling information for all contents file and status code. If we have identified the exact content type and status code for investigation, checking FREB information will not be a challenge.

 

However, if the status code is general or the content type is not certain when we want to narrow down a problem, we have to enable FREB for all contents and a range of status code, on a busy server, the FREB results may contain quite a lot of xml files, such as 5000 or more in a short time. In this situation, if we want to group all client IP addresses and know which one used specific ASP.NET Session ID, or how various clients have been written customized module parameters, it will be difficult because the complicated XML files are not like CSV formatted files which can be fully parsed by log parser or imported to SQL tables for analysis easily.

 

In this situation, we can use the Powershell to quickly get information we want. Powershell is good at String Regular Expression, using select-string to get matched strings from file, format-table –groupby to groupby key words we wanted, or use Powershell programming to proceed data further on the filtered output.

 

Below are some simple scenarios on how we can use Powershell to retrieve data:

 

1. Find out all FREB files which Headervalue which contains IP addresses:

 

Command:

select-string "headervalue"">\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" *.xml

 

Result:

fr2007423.xml:1821:  <Data Name="HeaderValue">10.11.244.93:1262</Data>

fr2007424.xml:1363:  <Data Name="HeaderValue">10.11.216.87:1817</Data>

fr2007425.xml:1821:  <Data Name="HeaderValue">10.11.244.93:1264</Data>

fr2007700.xml:1545:  <Data Name="HeaderValue">10.11.218.141:1190</Data>

 

2. Group FREB xml files by Application Pools:

 

Command:

select-string "appPoolId=" *.xml  |format-table filename -groupby line

 

Result:

 

   Line:                appPoolId="DefaultAppPool"

Filename

--------

fr2007423.xml

fr2007424.xml

 

   Line:                appPoolId="TestAppPool"

Filename

--------

fr2007425.xml

fr2007700.xml

 

3. Group FREB xml files by “set-cookie” behavior, and find out which client IP received set-cookie requirement from server side from the group result.

 

When FREB number is limited, this requirement can be done manually:

 

a. Run this command first to get the grouped FREB file list under different set-cookie values:

 

select-string "set-cookie" *.xml  |format-table filename -groupby line

 

Result:

 

   Line: Set-Cookie: ASP.NET_SessionId=nqt543za1jrlsz55whtgllbf; path=/

Filename

--------

fr2007792.xml

 

 

   Line: Set-Cookie: ASP.NET_SessionId=ah3ezs3wbd23gtfzksbhi2qg; path=/

Filename

--------

fr2007848.xml

 

b. And then check the two XML files one by one to find out the client IP.

 

Now if there are plenty of  XML files, if we want to quickly go through the result and find interesting data, it’s better to use an automation method. Here I used Powershell programming:

 

1. Create C# program, add reference to the Powershell assembly:

 

C:\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0\System.Management.Automation.dll

 

2.  Copy below code into the program.cs:

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

using System;

using System.Collections;

using System.Collections.ObjectModel;

using System.Text;

using System.Management.Automation;

using System.Management.Automation.Runspaces;

using System.Text.RegularExpressions;

using System.Runtime.InteropServices;

using System.Configuration;

 

namespace DigFreb

{

    class Program

    {

 

        static void Main(string[] args)

        {

 

            RunspaceInvoke invoker = new RunspaceInvoke();

 

            string[] input = {@ConfigurationSettings.AppSettings["groupbykey"].ToString()};

            string[] input2 = {@ConfigurationSettings.AppSettings["inlinekey"].ToString()};

            string path = ConfigurationSettings.AppSettings["path"].ToString(); ;

 

            IList errors;

            string scriptBlock =

                          "(select-string $input -path " + path + "*.* " + "| ft filename -groupby line |out-string -stream)";

 

            string matchPattern = "fr[0-9]*.xml";

            Regex RE = new Regex(matchPattern, RegexOptions.Singleline);

            string temp;

 

            foreach (PSObject thisResult in

                     invoker.Invoke(scriptBlock, input, out errors))

            {

                temp = thisResult.ToString ();

                if (temp.Length != 0)

                {

                          Console.WriteLine("{0}", temp);

                }

                               

                if (RE.IsMatch (temp) )

                {   //Get data from subitems

                    // Create and open a runspace

                    Runspace runspace = RunspaceFactory.CreateRunspace();

                    runspace.Open();

 

                    // Create an empty pipeline

 

                    Pipeline pipeline = runspace.CreatePipeline();

 

                    Command dirCommand = new Command("select-string");

                    dirCommand.Parameters.Add("path",

                         path +temp);

                    dirCommand.Parameters.Add("pattern",input2[0]  );

             

                    // Add the command to the pipeline

                    pipeline.Commands.Add(dirCommand);

                    Collection<PSObject> results = pipeline.Invoke();

                    foreach (PSObject tempResult in results)

                    {

                        Console.WriteLine("*****Found*****");

                        Console.WriteLine(tempResult.ToString());

                        Console.WriteLine("");

                    }

 

                }

        

            }

            foreach (object thisError in errors)

            {

                Console.WriteLine("Error: {0}", thisError);

            }

        }

    }

}

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

 

3. Add app.config to allow you set different query strings in powershell out of the application:

 

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

  <appSettings>

    <add key="groupbykey" value="set-cookie" />

    <add key="inlinekey" value="headervalue&quot;&gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" />

    <add key="path" value="h:\temp\freb\" />

    </appSettings>

 

  <!--

  &lt; < less than

  &gt; greater than

  &amp; & ampersand

  &apos; ' apostrophe

  &quot; " quotation mark

  -->

</configuration>

 

Compile the project as digfreb.exe, then you can use the .EXE easily to do below jobs once a time:

 

1. Group FREBs by a groupbykey

2. Go through grouped XML files and output interesting data by using the inlinekey.

 

From example:

 

Digfreb.exe >1.txt

 

Open the 1.txt, the result is as below, we can get the grouped information and how sub-items contain the interesting data we need:

 

   Line: Set-Cookie: ASP.NET_SessionId=n43goc45yisyl3551ifuvi55; path=/

Filename                                                                        

--------                                                                       

fr2297517.xml                                                                  

*****Found*****

H:\temp\freb\fr2007517.xml                                                                   :1363:  <Data Name="HeaderValue">10.18.220.232:1535</Data>

 

   Line: Set-Cookie: ASP.NET_SessionId=mkecgo55giwapv55rtyphtna; path=/

Filename                                                                       

--------                                                                        

fr2297687.xml                                                                  

*****Found*****

H:\temp\freb\fr2007687.xml                                                                   :1545:  <Data Name="HeaderValue">10.18.218.141:1189</Data>

 

   Line: Set-Cookie: IIS40P=b7dd6f18899b677f8ea9b8dc3a41c3b02bb1542fa1ba9dae7b59

3f1406bd431b;Path=/

Filename                                                                       

--------                                                                       

fr2297701.xml                                                                  

*****Found*****

H:\temp\freb\fr2007701.xml                                                                   :1821:  <Data Name="HeaderValue">10.18.218.141:1190</Data>

 

H:\temp\freb\fr007833.xml                                                                   :1820:  <Data Name="HeaderValue">10.18.220.55:1540</Data>

 

Regards,


Freist Li

 

Symptom:

According to BizTalk best practice, we should ensure BizTalk related SQL jobs were enabled and running well in SQL agent. These jobs would help maintaining BizTalk Databases under healthy status. However, if go to SQL Activity Monitor, the session status for job “MessageBox_Message_ManageRefCountLog_BizTalkMsgBoxDb” would always be shown as suspended

 

Explanation:

This symptom is expected due to the implementation of job “MessageBox_Message_ManageRefCountLog_BizTalkMsgBoxDb”.

This job will call another store procedure named bts_ManageMessageRefCountLog in BizTalkMsgboxDb. There is an infinite loop in that store procedure as illustrated below. Each time the loop body finished, there would be a 10 seconds delay. So once the store procedure is executing delay command, the SP’s status would be set to suspended and wait for the timer. If you pay special attention to the wait time column in Activity Monitor, you can find the value is always less than 10000ms.

……

WHILE (1 = 1)

BEGIN

--Do the job’s work     

      WAITFOR DELAY '0:00:10' --delay 10 seconds

END

……

 

More information for Reference:

Description of the SQL Server Agent jobs in BizTalk Server

http://support.microsoft.com/kb/919776

Regards,

Bryan Yang

 

 

Background:

==========

Customer experienced the high CPU utilization with their ASP.NET application and the CPU will fluctuate.

 

Analysis:

==========

We found a lot of exceptions generated and this could severely impact the application performance. We got the crash dump which signified the  “GetManifestResourceNamesForAssembly” throws “System.NotSupportedException”.

 

The following is the call stack:

0:024> !clrstack

OS Thread Id: 0x25dc (24)

ESP       EIP    

1ca6e990 7c80bee7 [HelperMethodFrame: 1ca6e990]

1ca6ea34 7983a771 System.Reflection.Emit.AssemblyBuilder.GetManifestResourceNames()

1ca6ea40 6ca781b4 System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource.GetManifestResourceNamesForAssembly(System.Reflection.Assembly)

1ca6ea6c 6ca785d2 System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource.AssemblyContainsResource(System.Reflection.Assembly, System.String ByRef)

1ca6ea84 6ca77cf1 System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource.LoadResources(System.String, System.String, System.Collections.Generic.ICollection`1<System.String>, System.Data.Metadata.Edm.MetadataArtifactAssemblyResolver)

1ca6eac0 6ca782ea System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource.CreateResourceLoader(System.String, ExtensionCheck, System.String, System.Collections.Generic.ICollection`1<System.String>, System.Data.Metadata.Edm.MetadataArtifactAssemblyResolver)

1ca6eae8 6ca59488 System.Data.Metadata.Edm.MetadataArtifactLoader.Create(System.String, ExtensionCheck, System.String, System.Collections.Generic.ICollection`1<System.String>, System.Data.Metadata.Edm.MetadataArtifactAssemblyResolver)

1ca6eb04 6cb06474 System.Data.EntityClient.EntityConnection.SplitPaths(System.String)

1ca6eb44 6cb077c1 System.Data.EntityClient.EntityConnection.GetMetadataWorkspace(Boolean)

1ca6eb78 6caa339b System.Data.Objects.ObjectContext.RetrieveMetadataWorkspaceFromConnection()

1ca6eb80 6caa45bd System.Data.Objects.ObjectContext..ctor(System.Data.EntityClient.EntityConnection, Boolean)

1ca6ebb0 6caa46b0 System.Data.Objects.ObjectContext..ctor(System.String, System.String)

1ca6ebc4 1f6e2739 JGB.Qy.EntityModel.JGBQyDBEntities..ctor()

1ca6edf0 79e71b4c [GCFrame: 1ca6edf0]

 

 

0:024> kb 10

ChildEBP RetAddr  Args to Child             

1ca6e908 79eda99c e0434f4d 00000001 00000001 kernel32!RaiseException+0x53 [d:\nt\base\win32\client\thread.c @ 1540]

1ca6e968 79fb48f8 0b1fa198 00000000 00000000 mscorwks!RaiseTheExceptionInternalOnly+0x2a8 [f:\dd\ndp\clr\src\vm\excep.cpp @ 2735]

1ca6ea2c 7983a771 0b1fa198 1ca6ea64 6ca781b4 mscorwks!JIT_Throw+0xfc [f:\dd\ndp\clr\src\vm\jithelpers.cpp @ 4777]

1ca6ea38 6ca781b4 0b1f9e60 00000000 00000000 mscorlib_ni+0x77a771 --- PARAMETERS DUMPED BELOW.

WARNING: Stack unwind information not available. Following frames may be wrong.

1ca6ea64 6ca785d2 1ca6ea8c 0b1ea300 06a5fc8c System_Data_Entity_ni+0x4d81b4

1ca6ea7c 6ca77cf1 0b1ec7ec 0b1ea4d8 0b1f075c System_Data_Entity_ni+0x4d85d2

1ca6eab0 6ca782ea 0b1ea300 0b1e9e9c 0b1ea46c System_Data_Entity_ni+0x4d7cf1

1ca6ead4 6ca59488 0b1ea300 0b1e9e9c 00000000 System_Data_Entity_ni+0x4d82ea

1ca6eaf0 6cb06474 0b1ea300 0b1e9e9c 00000000 System_Data_Entity_ni+0x4b9488

1ca6eb3c 6cb077c1 0b1e919c 00000000 0b1e9148 System_Data_Entity_ni+0x566474

 

Connection String: Data Source=svr1;Initial Catalog=JGBDB;Persist Security Info=True;User ID=xxxxx;Password=xxxxxxx;MultipleActiveResultSets=True

 

Related CODE

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

We check the top call stack functions with reflector:

 

Private Shared Function AssemblyContainsResource(ByVal [assembly] As Assembly, ByRef resourceName As String) As Boolean

    If (resourceName Is Nothing) Then

        Return True

    End If

    Dim str As String

    For Each str In MetadataArtifactLoaderCompositeResource.GetManifestResourceNamesForAssembly([assembly])

        If String.Equals(resourceName, str, StringComparison.OrdinalIgnoreCase) Then

            resourceName = str

            Return True

        End If

    Next

    Return False

End Function

 

 

Friend Shared Function GetManifestResourceNamesForAssembly(ByVal [assembly] As Assembly) As String()

    Try

        Return [assembly].GetManifestResourceNames

    Catch exception1 As NotSupportedException

        Return New String(0  - 1) {}

    End Try

End Function

 

Explaination on NotSupportedException:

 

The exception that is thrown when an invoked method is not supported, or when there is an attempt to read, seek, or write to a stream that does not support the invoked functionality.

 

Since the “NotSupportedException” will be thrown frequently, it imposed heavy load to system resources and CPU utilization is pretty high.

 

Solution:

======

Based on our discussion with product team of Entity Framework, the issue can be identified to be a bug which will be fixed in the next version of .NET framework (4.0). I searched through internet and found several issues rose without a solution/workaround. I hence would like to share with you guys our outputs which have been proved to be helpful:

·         By default, the EF designer creates a connection string that looks like below :

o    connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\sqlexpress;Initial Catalog=PeopleBlogs;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />

o    The “res://*” in the metadata keyword means that the Entity framework will go through the calling assembly, all the referenced assemblies of the calling assembly and the loaded assemblies in the current app domain to find the specified metadata resource( in the above case, Model1.csdl, Mode11.ssdl and Model1.msl).

·         The problem that you are hitting is that we use GetmanifestResourceNames method to see what resources are present in an Assembly but this method will throw a Not Supported exception in case of dynamic assemblies. In .Net 3.5, CLR did not provide any way to check if an assembly was dynamic, so we caught the exception and continued. In .Net 4.0, CLR added a Assembly.IsDynamic property which we now use so that the exception is not thrown.

·         There are a couple of ways to work around the problem in .Net 3.5 SP1:

o    If you know the full name of the assembly, you can provide a connection string as follows( the text in red is full name of assembly that contains the metadata resources):

§  connectionString="metadata=res://EFResAPP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null/;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\sqlexpress;Initial Catalog=PeopleBlogs;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />

o    You can also specify the path to the metadata folder( or all the files) on the disk:

§  connectionString="metadata=c:\metadatafolderpath\;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\sqlexpress;Initial Catalog=PeopleBlogs;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />

§  connectionString="metadata=c:\metadatapath\Model1.csdl|c:\metadatapath\Model1.ssdl|c:\metadatapath\model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\sqlexpress;Initial Catalog=PeopleBlogs;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />

 

Regards,

 

Yawei Wang

 

More Posts Next page »
 
Page view tracker