It’s been awhile since I’ve done any BizTalk development since my last project got canceled. However, we are still using BizTalk, and with that comes administration. One of the more tedious tasks is responding to suspended messages. There are a couple of common tasks that I do when I see that a message has been suspended. - Resume because a destination location that was unavailable is now available (i.e. Customer Web Service)
- Terminate instance because it’s not a critical message and do nothing else
- Terminate instance, then fix and resubmit message
While BizTalk provides the BizTalk Administration tool in BizTalk 2006, which is a much needed improvement over the tools in BizTalk 2004, it leaves something to be desired. What I would like is a web based tool to manage my suspend queue, with some additional logic for filtering messages, so I can quickly determine if I need to terminate or resume. I’d like a web based tool, because I don’t have direct access to the SQL server that BizTalk uses as it’s in a DMZ. A web tool would allow me to manage the suspend queue from anywhere, even from home. After a bit of searching, I didn’t find anything else out there that fit my exact needs. There was a project on CodePlex that looked like it might have been a good start, but didn’t look like it had suspend queue management (but it did look like it had support for configuring the various artifacts, like ports, orchestration, etc). I decided to write my own, as with most endeavors, it would serve as a good learning experience. While searching for an already made tool, I found several references to Microsoft.BizTalk.Operations for getting messages out of BizTalk. After playing around for a bit I got something working that returns me a list of suspended messages. using Microsoft.BizTalk.Operations
...
Operations operations = new Operations("localhost", "BizTalkMgmtDb");
List<BizTalkMessage> suspended = new List<BizTalkMessage>();
foreach(BizTalkMessage in operations.GetMessages().Cast<BizTalkMessage>())
{
if ((msg.MessageStatus & MessageStatus.SuspendedAll) != 0)
suspended.Add(msg);
}
return suspended;
I found out that I needed some other Dll’s as well:
- Microsoft.BizTalk.DBAccessor (pulled from GAC)
- Microsoft.BizTalk.Operations (%Program Files%\Microsoft BizTalk Server 2006\)
- Microsoft.BizTalk.Pipeline (%Program Files%\Microsoft BizTalk Server 2006\)
- Microsoft.BizTalk.Tracing (pulled from GAC)
- BTSDBAccessor.dll (non-managed code. Add to project and set to copy to output directory)
Since I’m using BizTalk dll’s that are only available by installing BizTalk sever, I won’t be able to redeploy those, so you’ll have to add them your self and rebuild the project. So yes, eventually I’d like to release the source for this little project.
After I was able to get references to the suspended messages, that left inspecting the messages to get various information, like why it was suspend, and the actual message body, and finally executing the resume or terminate command.
Resume and terminate are really easy, as once you have the message, you can just use it’s InstanceId property and pass it to operations.ResumeInstance or operations.TerminateInstance. Getting the message body is a little more difficult, but not that bad.
public static string GetMessageBodyAsString(BizTalkMessage message)
{
string body = string.Empty;
using (System.IO.StreamReader reader = new System.IO.StreamReader(message.BodyPart.Data))
{
body = reader.ReadToEnd();
}
return body;
}
Ok, so it wasn’t that easy. When I went to run my code I got the following error when trying to access the Message.BodyPart property of BizTalkMessage: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) – Microsoft.BizTalk.Pipeline. I thought that maybe I had an incompatibility between RTM and R2 versions of the various DLLs. Well, I fixed that but the error persisted. It was at this time I realized that the unmanaged code (BTSDBAccessor.dll), might not be compatible with my 64bit operating system. So I tried running this on a 32 bit box, and got another exception that indicated that I was most likely missing a dependency for BTSDBAccessor. Finally, I ran the code on a 32 bit box that had BizTalk installed, and it worked fine.
So you might be asking yourself, why wouldn’t you run this on the BizTalk box? Well I want this to be accessible via the web, and our BizTalk box does not do any front end web hosting, that is handled my a separate set of machines in another zone. I also wasn’t planning on installing BizTalk on the front end web servers either, so I needed to come up with a work around that avoided a BizTalk install. Using ProcessMonitor, I was able to come up with a list of dll’s that my application was accessing, which I have listed below. These dll’s reside in %Program Files%\Microsoft Biztalk Server 2006 on 32 bit systems, or in a bin64 sub-folder on 64 bit systems. Some of the dll’s need to be registered using regsvr32.
- BTSCache.dll (regsvr32)
- BTSDBAccessor.dll
- BTSErrorHandler.dll (regsvr32)
- BTSMessageAgent.dll (regsvr32)
- BTSPerfCounters.dll
- BTSSchemaCache.dll
So now I have my test app running on a 64 bit install of Server 2008, just like my web front end servers, and I am able to query messages, find the suspended messages, and terminate those messages that are suspended. My next step, and topic of part 2 will be turning this into some type of web based application. I haven’t decided if that will be Asp.Net, Asp.Net MVC, or Win Forms using WCF web services.
UPDATE:
I was having some problems registering the unmanaged DLL’s on another Server 2008 machine (error code 0x80070005), which seems be an access denied error. I should point out that I was using a batch file to register all of the dll’s, which I also tried doing a run as Administrator. That failed, but with a different and even less helpful error message. I eventually opened up a command prompt as an administrator and manually ran regsvr32, and that seemed to work.
Previously I talked about how Sony Vaio laptop’s have the hardware assisted virtualization (VT) flag locked off, which means no Hyper-V. I took the Sony back and spent 2 hours at Best Buy with the wife looking for a new laptop (I really wanted her to see what she was getting), and settled on an HP dv7-nr1025nr. - P8400 Core 2 Duo
- 4 GB of Ram
- 320 GB 5400 RPM Hard Drive
- NVidia 9600 GT 512MB
- 17” @ 1680x1050
- Altec Lansing Speakers w/Subwoofer (these actually sound good in a quiet room).
Overall, a solid machine, and the wife really liked the 17” display, as she realized the larger display would allow for more content on the screen at one time, which is good when doing remote tech support (which is what she has to do sometimes). I still like the physical characteristics of the Sony, but at least HP doesn’t cripple the processor, and the video card is a lot better. Upon arriving home, I see a Dell flyer in the mail advertising Studio 15 and 17” laptops with discrete video cards on sale, and promptly throw it away, thinking “don’t need this anymore”. I plug in the HP and turn it on, and am greeted with a blue screen, stop code 0x7E. No problem I think to my self, probably a bad driver or something, I’m going to reformat anyway. I actually executed the built in system restore so I could create restore DVD’s, allowing me to reclaim all my HD space. After the restore DVD’s were complete, I ran memTest86 for 12 hours and then proceeded to install Windows Server 2008. No problems, got everything installed, hyper-v running, all is good. Since Hyper-V disables standby and hibernate, if you leave the laptop unplugged while running, you will drain the battery, which is what the wife did Tuesday night. We plug it in, turn it on, and bam, blue screen, stop code 0x7E, now that’s interesting I say to myself. Turn the machine off, wait 30 seconds, turn it on, works perfectly. Shut it down, reboot, update the bios, etc, working fine. I decided to shut it down before I went to bed as a “final” test, and was rewarded with a 0x7e blue screen the next morning. I spent some time analyzing the MEMORY.dmp file using WinDbg, as I’ve always wanted to try that out, but I couldn’t figure anything out. Usually you should see some type of driver implicated, but I didn’t. I made the decision that it just wasn’t worth it to screw around with this problem on a new computer, so back to Best Buy I went. When I returned the Sony, I said I didn’t like it, and no questions were asked (maybe cause I said I was going to do an exchange). This time I said it doesn’t work, and my reward for being honest was a 10 minute detour to the Geek Squad bench to have them “check it out”. After explaining 3 times to the “technician” what the symptoms were, he promptly says “I think I know what it this, it’s a bad video driver”. I knew better then to open my mouth, and just let him turn it on, and the laptop did not disappoint, it blue screened on cue. So I’m thinking to myself, sure wish I had that Dell flyer I got last week. Thankfully Dell finally has the Studio laptops with the discrete video cards on their site (again), so I think I’m going to go with one of those. At this point I’m trying to decide if it’s worth the extra $$ to go with the uber 1920x1200 RGB LED display or not. They also have the Mini 9 for $99 deal, and I can’t pass that up, although I have to add an extra $125 to get 1GB of ram and the 32 GB SSD. Look for a future post on how this all ends, and a review of the Mini 9.
After spending some time (obviously not enough time) searching for a new laptop for the wife (and yes, a little for me) I settled on a Sony Vaio FW-139 that was on Best Buy's outlet center. It had a newer Intel Core 2 Duo P8400, 3GB of ram, an ATI HD 34xx video card and a 16.4" screen all for $849. I ordered it on Sunday night and it was here on Wednesday, so far so good. It came with Vista 32 bit and I wanted to put Server 2008 64bit so I could run hyper-v. No problem I thought, I'll just wipe it and install from scratch. I even followed the instructions to create a recovery dvd so I could restore the laptop to it's factory state. So I got Server 2008 64bit installed, and went to go look for drivers, and here is where I realized I made a mistake in picking out this laptop. I assumed that Sony would have 64bit drivers for this model, well they didn't. I spent about 4 hours rounding up drivers and got just about everything working. Not a big deal I though, and it was my fault that I didn't check on the driver situation first. Went to fire up hyper-v and it said it couldn't start because the VT flag was disabled. No problem right? Just reboot, go into the BIOS and.....wow, this is the most bare bones bios I have EVER seen. I can change the boot order and that's it. Off to Google I went, and found out I was not alone. Sony disables the VT flag and does not give you an option to enable it. Some people have gotten creative and used a dos utility to edit the NVRAM directly, but the register you have to edit varies by model/bios. I think someone said it's listed in the fine print somewhere that the VT flag is disabled, but even if that's true, I'm still calling BS on this. I'm not going to mess around with the NVRAM on a brand new computer for something that shouldn't be disabled in the first place. Tomorrow I will be going to Best Buy to hopefully return the Sony and start my search once again. I really liked that P8400 processor, as it runs at 25w instead of 35w, which is what the T5800 runs at (the T5800 is the most common processor in the price range I was looking at). Given how much time I have spent researching, I think I might up my price to $1000 and hopefully save me some time. That should give me a few more options when looking for a laptop with a discrete video card as well.
I have a stored procedure, that when run from Sql Server Management Studio (SSMS) takes 1 second to run. When invoked from my web application via ADO.Net, it takes > 30 seconds (web application gets a SQL timeout). Running SQL profiler shows that the following commands are executed prior to the execution of the stored procedure: set quoted_identifier on set arithabort off set numeric_roundabort off set ansi_warnings on set ansi_padding on set ansi_nulls on set concat_null_yields_null on set cursor_close_on_commit off set implicit_transactions off set language us_english set dateformat mdy set datefirst 7 set transaction isolation level read committed Running the above commands, and then my stored procedure in SSMS, and I can reproduce what is happening in my web application. The stored procedure is taking 34 seconds, or just passed the default SQL timeout in ADO.Net. Not that 29 seconds would be acceptable to me. I know that the default isolation level is “read committed”, so I was pretty sure that wasn’t the problem, so I decided to start at the top and switch each on to off and vice-versa. Luckily I didn’t have to go far, as setting arithabort to on, returned my query execution time to 1 second, and turning it off resulted in > 30 seconds as a repeatable result. Digging around on Google gave me a couple of posts (Greg Stark, Steven Smith) where people were having the exact same problem (it was weird how similar the posts were worded to each other and mine). As I thought, SQL server creates two separate query plans based on the arithabort setting, and the plan for arithabort OFF obviously sucks. I came up with 3 options from the posts: - In ado.net set Arithabort to On
- Add With Recompile to my stored procedure(goes between your stored procedure paramaters and the as keyword at the top)
- Set Arithabort to On at the server level
Option #1 seems like a pain, and no one who commented in the posts seems to be taking this route. That leaves options 2 and 3. It sounds like Arithabort ON is better then Off, but I am a little hesitant to set it to ON at the database level. Well, only a little hesitant, as I just set it to on, and nothing blew up, so I think I’ll go with this setting over the long weekend. With the limited use our system gets over the holiday, it will be a good test.
Overview Last week my wife told me she wanted to cancel our DirectTV, because she did not think we used it enough to justify the $74.99/month we were paying. I couldn't really find any fault in her logic, other then the fact that we would pay a $120 early termination fee. In it's place, the Wife wanted to re-subscribe to Netflix, as all of the shows we did watch, are available, and allot of them are available via streaming. So we signed up for the 2 DVD at a time plus unlimited streaming for around $14.99 I believe. So where does the home theater PC (HTPC) fit in? Well, I figured that if we are getting rid of DirectTV, now would be the perfect time to invest in a HTPC to replace my aging modded XBox and Xbox Media Center. While functional, it lacked the horse power necessary for high quality H264 encoded videos, and windows networking was a bit of a pain. Component Build List I remember reading a post by Jeff Atwood early this year were he upgraded his HTPC on the cheap, and decided to work off his parts list. Since it's been almost 7 months since his post, prices have dropped, and I was able to get a relatively the same build for less money. The 2.4 Ghz AMD was replaced with a newer model running at 2.5 Ghz, and I opted for 4GB of ram. The most expensive item you can see was the case with an 80plus power supply. I had a copy of Vista Ultimate laying around that I won at a meeting somewhere. Not on the list below is a wireless keyboard and mouse (currently a MS 6000 that I want to take back and try a Logitech at the same price point as the MS one doesn't work at 10' on my lap even though it claims a 30' range). Also missing is a 2.5" to 3.5" mount adapter for the laptop hard drive. Assembly was straight forward, although the case gets quite cramped. The included power connectors are not satisfactory for an all SATA build like I was doing. I have no idea how they thought the power cables would even reach. I had to use some Molex to SATA convertors, which also served as extenders to power everything. Installing Vista Vista Ultimate installed fairly quickly as well, although it appears to hang on the first gray screen giving the impression that it's locked up. Oh, forgot to mention, the retail case for Vista is a real treat to open ;) Here is a quick run down of how I setup my HTPC. - Change video card memory in BIOS from automatic to 512MB.
- Install Vista Ultimate with SP1(64 bit)
- Install all latest windows updates
- Joined to domain and set static IP
- Create _WorkstationUsers group for setting permissions. I create this local group on all my PCs so if I ever need to change user accounts, I can just add it to this group.
- Add exceptions for remote desktop, and file/printer sharing in Windows Firewall.
- Installed .Net 3.5 with SP1
- Installed AMD power monitoring software. Observed processor dropping down to 1800 mhz and lower voltage
- Created Domain User and related group for logging into the HTPC.
- Stopped following Services
- DHCP Client
- Diagnostic Policy Service (DPS)
- IP Helper
- Tablet PC Input
- Windows Media Center Receiver Service
- Windows Media Center Scheduler Service
- Windows Search
- Add registry entry for .mkv files (see below)
- Installed vista codec packs from http://shark007.net
- Vista 32 bit version 473
- Vista 64 bit version 152
- Download Windows Media Player Classic
Vista Media Center (VMC) I had some issues getting getting my h264 encoded videos in an mkv container to show up and play in Vista Media Center. I first tried the Combined Community Codec Pack (CCCP) as I've had really good luck with it in the past. What I didn't realize is that it's designed for 32 bit systems (specifically the Haali Media Spliter), and VMC uses a 64bit player. After some research I found a forum post that suggested using the 32 and 64 bit Vista codecs that I linked above. After uninstalling CCCP and installing the Vista codec packs (and a reboot for good measure) I was good to go. One thing I'd like to point out, is that when adding folders to monitor for your library in VMC, it takes quite a long time for everything to show up, especially in network folders. I would suggest leaving VMC run overnight to get everything in the library the first time. So everything is working at this point, except for subtitles in the anime I get off the net. The easiest solution is to just drop out of VMC and use Media Player Classic. The Vista Codec pack supplies a subtitle codec that's worked with everything I've thrown at it so far. Encoding Video I have a bunch of DVD's I want to encode to my new HTPC. Previously I've used XVid, but the times have changed and H264 is the new king on the block. I'm using the latest dev snapshot of Handbrake (www.handbrake.fr) with the following settings: - High Quality Film (1800 video bit rate)
- AC3 Pass thru
I can't tell the difference between the original DVD and my encoded file. Star Wars Episode 3 was compressed from ~7.4 GB down to ~2.4G, with full AC3 surround sound. Registry Entry for .MKV files Copy between the lines, paste in Notepad _______________________________ Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\.mkv] "PerceivedType"="video" "Content Type"="video/mkv" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Multimedia\WMPlayer\Extensions\.mkv] "Runtime"=dword:00000007 "Permissions"=dword:0000000f "UserApprovedOwning"="yes" _________________________________
Allow me to leave the realm of technology and offer up my thoughts on the election, just like every other blogger out there. In an effort to be up front, I will state that I voted for McCain, although this will be the last year that I vote for someone strictly because they are a republican. I think it’s time to start seriously looking at independent candidates, although I feel that the republicans will be re-energized in 4 years. I am grateful that the election is over and I can listen to Pandora without having a giant picture of Obama smiling at me (not that McCain would have been any better, maybe Palin would have been ;) ). The Pandora add illustrates the type of campaign that Obama was running, and other candidates should have taken notes. I feel that this election was too much about race, and I cringe when I hear people talk about the first black president, and how this shows what America is really about. Yes, in fact it does show what America is about, and that is, that for all our talk, race STILL IS an issue, otherwise no one would be mentioning it now! I will celebrate the day when a candidate can win (be they white, black, man, women, etc) without playing the race/gender card (and yes, white males can play that card as well). I also think it will be a more momentous occasion when an independent candidate is elected President, as Democrats and Republicans are more alike then they are different. Scott Hanselman has been blogging a bit about the race, as well as the outcome last night. Scott is someone who I can identify with because we share a similar passion about technology. Scott made this comment in his post, “My boys will grow up in a country that values people of all kinds, including ones that look like them.” and I’m a little disappointed, as are a few of the people who left comments. To think that I or anyone else valued his children less because they have a darker skin complexion is something I wholeheartedly disagree with. Furthermore, to think that the election of a President with a darker skin complexion, who played the race card, illustrates a flaw in our society that must be overcome before I start celebrating. To be honest, I think Scott’s family shows a more positive image about America, with respect to the race issue, then the election of Obama. In the end, I just get the feeling that the Republicans knew they were going to loose no matter what. I don’t think they threw in the towel, but maybe they felt it better to conserve their resources to fight another day. While I hope for a dramatic turn around in the economy, history has shown that it follows a different set of rules. There is a tough road ahead for the Democrats, and they have 2 years to fix everything, or we’ll have a repeat of 94 when the republicans took control of congress.
I don’t know about your experiences with server manager, but mine are less then positive from a resource usage point of view. On decent hardware I’ve seen this peg the CPU to 100% for a good minute. Even on a multi-core system this can be a problem where you have business processes running. Server Manager, by default starts up whenever you log into Windows Server 2008. While there is a check box that allows you to disable the auto-launch of server manager, it’s a per user setting, and you have to do it on every server you log into. Thankfully there is a solution. This article lists two registry settings that you can change that disable the auto-launch. Couple this with group policy and you no longer have to worry. | Setting Name | Location | Default Value | Possible Values | | Do not open Server Manager at logon | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Server Manager | 0 | 0 to disable and open the window normally; 1 to enable and prevent the window from opening. | | Do not open Initial Configuration Tasks at logon | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Server Manager\Initial Configuration Tasks | 0 | 0 to disable and open the window normally; 1 to enable and prevent the window from opening. | I prefer to put a shortcut to Administrative tools on my desktop, and from there I can access only the functionality I need.
Recently there has been some talk about a bunch of us getting iPhones thru work. Even though I have vowed to never own an Apple product, I figured I wouldn’t be too much of a hypocrite if work paid for it. Well that deal kind of fell thru, but it did get me looking into an upgrade for my Mogul, as it appears I have a $150 new phone credit available to me thru Sprint. I did do some research into the iPhone to see if I would even be able to “use” it, should work have provided one. For the most part it seems like a decent phone, however there are a couple of things that made me go out and look to see what new WinMo phones were available. First, my 1 year old after market car stereo which has iPod support, does not have iPhone support (as confirmed by numerous posts on various forums). This isn’t so much a knock against either the iPhone or my car stereo, it just would have been a nice to eliminate the separate MP3 player I have now. Newer model head units are reported to have no problems with the iPhone, but I don’t want to buy a new head unit right now. Second, I have grown very used to my slide out physical keyboard on my mogul. I have heard mixed reviews about the touch keyboard on the iPhone, with one of the most negative criticisms being that the keyboard/mail program will not rotate to landscape mode. There are several hacks and work around's available, but as most people point out, this is something that should have been fixed in the 2.0 firmware. Finally, there seems to be a real need to install iTunes, and that’s probably the #1 issue I have against the iPhone. I’ve heard way too many horror stories about iTunes, the extra stuff it tries to install, etc. Don’t get me wrong, I’m not trying to hate on the iPhone, I just don’t think it’s for me. So, what is the phone for me? After some research, I’ve narrowed my search to the HTC Touch Pro. Specs: - 528Mhz Processor
- 228 MB of Ram, 512MB of ROM
- 2.8 VGA touch screen
- GPS, Bluetooth 2.0 +EDR (including stereo A2DP)
- Opera 9.5 built in
- MicroSD expansion slot
The reviews so far have been very positive. The TouchFlo3D interface developed by HTC looks very polished, but as people are quick to point out, the TouchFlo3D UI only works with certain applications. However, for 90% of my usage, I’d be using TochFlo3D applications, including E-Mail, and the Web Browser. The Touch Pro is supposed to have the option to connect via USB as a Mass Storage Device like the Touch Diamond (already released on Sprint), which is a huge selling point for me. I have no need for Active Sync or Windows Mobility Center since I use exchange for syncing. As a Mass Storage Device, I can just drag and drop files, and most media players support syncing. What’s even more important is that my car stereo does support Mass Storage Devices, which is how my current MP3 player connects. There are also plenty of free applications available for Windows Mobile, and as a developer myself, it is very easy for me to write applications for it should the need arise (which I must admit it hasn’t yet). I was working on a really cool Windows CE project that got canceled earlier this year, so I haven’t been into the mobile development as much. I have a couple of ideas for a proof of concept at work that having a WinMo phone would help. The phone should be released sometime soon, but in the meantime I need to pull my custom ROM off my Mogul and take it in for some service. The battery seems to be going, and my beloved slide out keyboard doesn’t close all the way (which I guess is a con of the slide out keyboard, the mechanism is susceptible to wear and tear).
A recent post by Scott had me look into how our IIS 7 servers were configured. Turns out we were not using dynamic compression (Ok, I already knew that as I’m the one who set them up), so I decided to go about installing the dynamic compression module (you can always un-enable it). If you already have IIS 7 installed, you can go into the Role Manager and add a role service. The dynamic compression is under the performance section. Once installed, you will need to enable it via the IIS 7 management tool, or use the following command line option: appcmd set config -section:urlCompression /doDynamicCompression:true The appcmd command line tool lives in C:\windows\system32\inetsrv, which is not included in PATH. You will want to review the httpCompression section in C:\Windows\System32\Inetsrv\Config\applicationHost.config to view what Mime types are compressed. By default, when you install dynamic compression, you get the following settings: <dynamicTypes> <add mimeType="text/*" enabled="true" /> <add mimeType="message/*" enabled="true" /> <add mimeType="application/x-javascript" enabled="true" /> <add mimeType="*/*" enabled="false" /> </dynamicTypes> I couldn’t find a page that specifically listed mimeTypes in the context of IIS 7, but here is the full list of MimeTypes itself which should give you an idea of how you can configure compression. As Scott points out in his article, you should make an attempt to justify your change, which I did by performing a simple test using a large web page (1.3 MB) we serve up, and noting the response size and time using Fiddler. The 1.3 MB web page originally took 30 seconds to receive (I know, there is something funny going on with the network connection somewhere, but it does easily illustrate the savings compression gives). Enabling compression shrunk the response to 130KB, taking only 6 seconds. For some additional information on compression in IIS 7 check out this blog entry by Kanwalijeet Singla.
Scott just blogged about T4, the Text Template Transformation Toolkit. It’s a full blown template driven code generation tool that uses the same syntax as Asp.Net. It’s lacking things such as syntax highlighting and intellisense, but it’s free, and part of Visual Studio. I feel with the recent press this tool is getting, it will become even more popular, and some of the missing features added by the community. Scott has a whole list of links on his post that provide good samples, as well as a link to a company that provides a free and pay version of a plug-in to add some of the “missing” functionality.
|