2007年10月5日

[BizTalk] Host not marker as trusted

I keep getting [please check to see if the host is marked as trusted.] error message while implementing RosettaNet. I am sure all host has been marked as trusted, but this error still occurs.

To solve this problem, first we have to know what a trusted host means and why is it so important.

Simply speaking, a trusted host is an evidence that the incoming message do sent from a partner you grant permissions to send you messages. Details are explained in this two articles.

So if the host has been marked as trusted, why the error keep on bothering me ?

We know that a A4RN receives incoming messages via HTTP , which means, incoming message must first processed by the IIS, in this stage, an pre-configured identify is assign to the process according to your website's application pool's identity. Incoming messages are then passed to A4RN receive port(HTTPReceive), which is also a HTTP port, which means, another identify is then assign to the process according to IIS settings.

Now, the HTTPReceive.dll is posting request into the message box with the IIS sepcified user identity, and if this account is not a trusted user account(which means, if this account is different with the one you specified in the Authentication Trusted host setting), then BizTalk denies this message from processing, because the user sending this message in is not a trusted user.

So the solution is to re-configure the IIS application pool identity to a trusted user account in BizTalk.

2007年9月27日

2007年8月21日

[.Net]Debug client script in VS2005

To debug client script in VS2005, You have to first enable Script debug in IE.

From IE's Tools menu, select Option, switch to Advence tab, Under the Browse tree node, uncheck [Disable Script Debugging(IE)] and [Disable Script Debugging(Other)], then open your web application from VS2005
  1. First press F5 to run your web application in debug mod
  2. From Debug menu item, select Window, then Script Explorer, this bring up a Script Explorer window
  3. From the explorer window, choose the script source you like to debug and add break point on the it

2007年8月11日

[BizTalk]When configuring BizTalk Accelerator for RosettaNet receive error messages

When configuring A4RN 3.3, I got an error message like this:

A Biztalk Isolated host instance configured with the user account was either not running or dose not exist...

This error occurs if when you installing A4RN, there are no trusted host instance configured on your box, hence A4RN installation process could not pick up a trusted user account for further configuration.

The only way I found to solve this error is to uninstall A4RN, then create a new host marked as trusted, the create a new host instance of that trusted host. Then in BizTalk Server Administration consol, I mark the newly created host instance as default host instace.

After all was done, then I reinstall A4RN. And now when configuring A4RN, no compliant will be shown.

In my opion, this is really stupid, they should have ask us for a new trusted user account, not just popup a error message.

2007年8月3日

[.Net]Stepping thru a unit test generates MDA FatalExecutionEngineError

I got this error message while implementing a CASmf client in C#. The error occurs while the client tries to invoke a CASmf WIN32 API casmf_recv().

So I google for a while and found this error only occurs in the following situation:
  1. When we are interop debugging. For example when you are invoking Win32 APIs from managed codes
  2. When does a "property eval" of a method that contains a breakpoint. For example when you are "watching" some variables in the debugger.

I totally match above situations, I am interop debugging and there IS a breakpoint on it. So I simply remove the breakpoint, and the clinet works fine.

There are 3 workarounds to this problem:

  1. Remove breakpoints
  2. Disable automatic property eval(ToolsOptions menu in VS2005). Remember that VS automatically calls ToString() method and property getters, so when your watch window is opened, or when you quick watch the code, this will happen.
  3. Use managed debugging only

2007年8月2日

[BizTalk] Cleanup MessageBox

To cleanup unprocessed messsages in message box, BizTalk Server provides a SQL stored procedure.

Here're steps to cleanup unprocessed message:
  1. Do IISRESET.
  2. Stop all BizTalk application and host instances
  3. Open SQL server management console, browse to [BizTalkMsgBoxDb].
  4. Execute bts_CleanupMsgbox stored procedure on BizTalkMsgBoxDb
  5. Execute bts_PurgeSubscriptions stored procedure on BizTalkMsgBoxDb
  6. Restart Biztalk server

Now your messages are deleted. And you have a emppy message box now :)

2007年7月26日

[.Net] Reflection for Generic Class

To dynamic create an object instance of generic type. Here's the sample code:

namespace GenericTypeNS{
public class GenericType{
......
}
}
...

Assembly asm = Assembly.LoadFrom(asmPath);
object o = asm.CreateInstance("GenericTypeNS.GenericType'1[[%TypeName%]]");

Replace %TypeName% to the specificed class name, for example if we want to create an GenericType object instance with System.Int32, it should look like this:

object o = asm.CreateInstance("GenericTypeNS.GenericType'1[[System.Int32,
mscorlib,Version=2.0.0.0,Culture=neutral,
PublicKeyToken=b77a5c561934e089]]");

2007年7月25日

[ASP.Net] CS0433 Error

When deplpying ASP.Net web site, you might get a CS0433 error with the following message:

Type [TypeName] already exists in both %ASP.Net Temp Folder%\[AssemblyName.dll] and %ASP.Net Temp Folder%\[AssemblyName.dll]%

This is confirmed a well known bug in ASP.Net.

The reason you got this error is that some of your ASP.Net pages/controls are cross referenced.
Say we have a ASP.Net web application with the following file structure:


AppRoot\Dir_a\PageA.aspx
AppRoot\Dir_a\ControlA.ascx
AppRoot\Dir_b\PageB.aspx
AppRoot\Dir_b\ControlB.ascx

If in PageA.aspx references ControlB.ascx in folder Dir_b, and PageB.aspx references ControlA.ascx in folder Dir_a then CS0433 error well be reported.

There are 2 ways to avoid this kind of error, one is to re-structure your file structure to prevent the cross reference. The other one is to add the following configuration setting in your web.config:

<configuration>
<system.web>
<compilation batch="false">
...


The reason we have to disable batch compilation is that when batch compile is enabled (ASP.Net default), ASP.Net compile each folder to an individual dll. So in our case, Dir_A/Dir_B will be compiled into 2 dlls, and it's clearly that they do cross reference.

2007年7月24日

[BizTalk]Message engine failed to process a message submited by adapter ...

When implementing custom pipeline components, sometimes we might get this error after we hook the component onto the pipeline:

The Messaging engine failed to process a message submitted by adapter:FILE...
Details:The published message could not be routed because no subscribers were found


This most likely cuase by some missing content properties we forget to promote after we created a new message and return it to the BizTalk engine. If those missing content properties participated in message routing, then the routing failed and you got above error message.

To correct this, we need add following codes in our custom pipeline to ensure every promoted properties in the origional message content is also promoted in newly created message content:


for (int iProp = 0;iProp < originalMsgContext.CountProperties;iProp++)
{

string strName;
string strNSpace;
object val = originalMsgContext.ReadAt(iProp,
out strName, out strNSpace);
// promote properties
if (originalMsgContext.IsPromoted(strName, strNSpace))
newMsg.Context.Promote(strName, strNSpace, val);
else
newMsg.Context.Write(strName, strNSpace, val);
}

string systemPropertiesNamespace = "http://schemas.microsoft.com/BizTalk/2003/system-properties";
string messageType = "http://testDisassmbler.testSchema#Tables";

newMsg.Context.Promote("MessageType", systemPropertiesNamespace, messageType);
return newMsg;

[BizTalk]Change character encoding in BTS pipeline

To change character encoding in BizTalk pipeline, first we have to know how BizTalk determined the character encoding of an incoming/outgoing message.

BizTalk Server 2006 uses following rules to find out the encoding of a message:
  1. If Byte Order Mark exists, then the encoding is determined
  2. If content property BodyPart.CharSet is set, then the encoding is determined
  3. If xml declaration exists, then the encoding is determined
  4. If none of above matches, UTF-8 is used

So to change message encoding, here are several ways:

  1. Add byte order mark
  2. Set BodyPart.CharSet content property
  3. Add Xml declaration

So it is NOT enough if you only change the actual data in the stream to specificed encoding, one of the above must be matched!

2007年7月23日

[SQL]Not associated with a trusted SQL Server connection

We had a integration issue while building a operation web to manage BizTalk Server 2006 comfigurations. Bellow is our environment:



  • BizTalk Server 2006 installed on Machine1
  • SQL Server installed on Machine2
  • OpWeb installed on Machine1, Using Forms authentication mode
  • Both machines in same domain
We want to configure BizTalk Server 2006 via op_web.The problems here is that I keep getting this error:
[Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. Reason: Not associated with a trusted SQL Server connection]



Obviously it's a complaint about the user has no access to the database server. But, why it's trying to connect to database server using the Anonymous Logon ?

When connecion to a database server which using windows authcentication mode from a ASP.Net web applicaiton,

  1. If impersonation is enabled, the user account used to connect to database server is the use account specificed in impersonate section in web.config.
  2. If impersonation is disabed, the user account used to connect to database server is which specificed in the application pool which the web application is running under.

So here is my solution:

  1. Use a Sql server logon instead of a windows account to access the database. You will have to ask your DBA to create a sql logon for you. This is the easist way.
  2. Use a Windows user account to access the database. To do this,
    1. Ask your administrator to create an account has similar priveleges with Network Service or ASPNET account.
    2. Set that account as anonymous access acount in op web if you need the anonymous access to be enabled.
    3. Ask your DBA to grant database access to that account and [Anonymous Logon] if necessary.
    4. Or, if you dont want to mess up with the IIS configuration, you can simply set the impersonate on in your web.config

2007年7月22日

New Blog

This blog is a branch from my live space : http://michaelspace.spaces.live.com/ , I'll post .Net Framework and Microsoft Server System related articles here.

Basicly these posts is about troubles I experience in our project , and the solutions or walk around I found. And maybe we can discuss those troubles and find a better solution here.

Blog Archive

About Me