Monday, March 17, 2014

Good ole loopback check - how I hate thee

It seems every year or so, I've run into the same issue over and over again. And every time I forget the resolution due to the vague security error message.

We receive an "HTTP 401.1 - Unauthorized: Logon Failed" error when using a local web service from another web site or web service on the same machine, using windows integrated authentication.

After a few hours of debugging and research, we discover the root cause is the loopback check security feature described in these kb articles:

http://support.microsoft.com/kb/926642
(Note: even though this article says this issue applies to Win 2003 SP1, it also applies to any Windows Server OS since then, including 2008-2012.)

The solution is to modify the registry and add a DisableLoopbackCheck entry or to add host names in BackConnectionHostNames registry entry.

I have run into this same issue with custom web services as well as when using a local SharePoint install, Reporting Services web services and even one scenario where a .NET web application was using local Java web services.

Tuesday, March 11, 2014

Removing ZoneIDs from downloaded files

If you are like me, you are constantly removing the ZoneID from files downloaded from the internet using the following approach:

Right-click File > Properties > Unblock

Thanks to this post from Raymond Chen's excellent The Old New Thing blog, I've found a way to remove the need to do this at all.

Group Policy editor
User Configuration > Administrative Templates > Windows Components > Attachment Manager > enable Do not preserve zone information in file attachments

Friday, June 28, 2013

Register or Restore a Hyper-V VM?

When you import a Hyper-V VM, the import wizard will ask if you want to register, restore or copy the VM. I always need to refresh my memory on whether I need to register or restore. This blog post explains the difference:
 
http://blogs.msdn.com/b/virtual_pc_guy/archive/2012/06/26/registering-a-virtual-machine-with-hyper-v-in-windows-8-windows-server-2012.aspx

Since I make sure that the files are exactly where I want them, with the corresponding changes in the config.xml file, I usually go with the register option.

Thursday, June 27, 2013

Fixing a Windows 8 network issue

Recently, OneNote 2013 on my Windows 8 VHD was refusing to sync with SkyDrive. It complained that I was not connected to the internet - even though I was able to access skydrive.com or any web site without any issues.

The problem seemed to related to my LAN connection showing an exclamation mark and also falsely indicating that I was not connected to the internet. Restarting did not fix the problem and I'm not sure how it got into this confused state.

Here is what I did to fix that:

1. Open CMD.exe as an Admin
2. Run the following command: netsh winsock reset
3. Restart the OS


Sunday, March 31, 2013

Convert Boot-to-VHD image to Hyper-V

The following post is a useful guide on how to modify a Boot-to-VHD image to work in Hyper-V:

http://blogs.msdn.com/b/bramveen/archive/2009/10/27/swapping-between-native-vhd-boot-and-hyper-v.aspx

From the command prompt, enter the following commands:

DiskPart

select vdisk file=C:\<VHDFILENAME>.VHD

attach vdisk

select part 1

active

assign letter=Z

exit

Z:

cd Z:\Windows\System32

BCDboot.exe Z:\Windows /s Z:\

BCDedit /store Z:\boot\BCD /set {bootmgr} device boot

BCDedit /store Z:\boot\BCD /set {default} device boot

BCDedit /store Z:\boot\BCD /set {default} osdevice boot

C:

Diskpart

select vdisk file=C:\<VHDFILENAME>.VHD

detach vdisk

exit

Saturday, March 23, 2013

Fixing a disk signature collision

I purchased two WD My Passport portable external hard drives recently. When I connected both of them to my computer, only one would show up as a drive.

Looking in Computer Management > Storage > Disk Management, the 2nd drive was shown as offline due to a signature collision. These are the steps I used to fix this problem.

  1. Open DISKPART from the Windows Run command (WIN+R)
  2. Enter the following commands:
  3. list disk
  4. select disk N
    Where N is the # of the offline disk
  5. uniqueid disk
    This will display the unique ID of the disk
  6. online disk
  7. uniqueid disk
    This will display the new unique ID of the disk
  8. exit

Friday, February 08, 2013

Problems with Windows 8 Store Apps stuck on pending?

I recently had a problem with updating apps from the Windows Store on a new laptop. They would end up stuck in a Pending state. I tried uninstalling and reinstalling the app but they still ended up in the same Pending state.

I resolved the problem using the following steps:

  1. Open a Command Prompt as an Administrator
    (Go to the Start screen, type "cmd", right-click on Command Prompt and hit "Run as administrator")

  2. Run the following four commands in the command prompt:

    net stop wuauserv
    cd %systemroot%
    ren SoftwareDistribution SoftwareDistribution.old
    net start wuauserv

  3. Retry installing the Apps/Updates again.

Tuesday, October 04, 2005

Code Camp 4 presentations

My slides and code samples for Code Camp 4 are now available for download. Thom Robbins did an excellent job putting this event together and getting the content posted online quickly.

Links and descriptions for my sessions...

Integration Technologies and Approaches
When it comes to integration, even within the Microsoft stack, there are several choices available: Web Services, Indigo, MSMQ, SQL Service Broker, Host Integration Server, BizTalk, SQL Server Integration Services and SQL Server Replication. This session will explain each option, cover the scenarios each one is suited for and some examples with source code. This session also serves as a good introduction to BizTalk Server and it's functionality.

Intro to AJAX (asynchronous javascript and xml)
What is it? How does outlook web access or Google maps provide functionality usually found in a desktop application? Material and code samples will cover the front-end (dhtml), back-end (asp.net/web services), tools/libraries to get you started (ajax.net) and what to expect down the road (Studio 2005 and Atlas). In addition, there will be discussion of issues to watch out for and general best practices.

Effective use of BizTalk as an Enterprise Integration platform
BizTalk can serve as the integration hub between multiple systems.
This session covers several EAI patterns and how they can be implemented in BizTalk. In addition, this session will also include some useful tips & tricks, examples of custom pipeline components & functoids in c#, and a quick overview of what to expect in BizTalk 2006.


All Session descriptions

Monday, September 26, 2005

BizTalk and MSDTC

I ran into a problem a while ago where the BizTalk SQL Adapter wizard would emit this error when I tried to create a new SQL adapter schema to pull data from a stored procedure.

Failed to execute SQL Statement. Please ensure that the supplied syntax is correct. An error occurred while enlisting in a distributed transaction
Transaction manager has disabled its support for remote/network transactions


I didn't have the error against my local SQL Server instance. It would happen when I tried it against the shared SQL Server machine the group used as a development sandbox.

I tried all of the steps mentioned at....

http://blogs.msdn.com/florinlazar/archive/2004/06/18/159127.aspx
and
http://support.microsoft.com/default.aspx?scid=kb;en-us;839187
and
http://support.microsoft.com/default.aspx?scid=kb;en-us;301600
and
http://cs.orange.us/blogs/thomas_mullaly/archive/2005/03/26/27.aspx


I eventually figured it was due to Windows XP SP2 and MSDTC and that SQL Server was not local. Looking into it a little more, I found this article from Microsoft....

How to troubleshoot MS DTC firewall issues

As mentioned in the article, I installed and used both the DTCPing tool and the DTCtester tool to identify the problem. I could DTC ping the server but the server could not DTC ping my laptop. For some reason, since my laptop was not a full member of the domain, the server had an invalid IP address for my laptop.

I fixed the issue by adding my laptop to the server's host file (c:\windows\system32\drivers\etc\hosts) with my correct IP address.

Again, this was only required in the development environment, and only because of the unusual situation my laptop was in (I'm a consultant and my laptop is not part of the domain and moves between many different networks).

More on DTCPing...
http://blogs.msdn.com/florinlazar/archive/2005/09/16/469064.aspx
and general MSDTC debugging...
http://www.chriskempster.com/articles/debugdtcissues.htm

Friday, March 18, 2005

Optimizing BizTalk for latency

BizTalk is optimized for throughput, not latency, by default. If you have low volume and want to speed up processing of individual messages, the following settings have helped one of my clients improve how long it took to run a message through BizTalk from several seconds to under a second:

· To decrease HTTP request-response latency, define a DWORD registry key named HttpBatchSize and set the value to 1. Create this registry key in the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTSSvc.3.0\HttpReceive folder.

This setting specifies the batch size that the HTTP receive adapter uses to submit requests to BizTalk Server. Ordinarily, the HTTP receive adapter waits to accumulate multiple messages to submit at once. It submits messages to BizTalk Server when the maximum batch size is reached, or at the preset waiting time periods. Setting the HttpBatchSize value to 1 causes the HTTP receive adapter to submit messages as soon as they are received.

· To decrease end-to-end latency, reduce the MaxReceiveInterval value in the adm_ServiceClass table of the BizTalkMgmtDb database from the default value of 500 to a value less than 100 (or any positive integer) for the following service classes:

· XLANG/s

· Messaging In-Process

· Messaging Isolated

These settings specify the maximum polling interval (in milliseconds) at which the messaging agent polls the message box. Microsoft does not support the direct modification of these values; you must use the tool at http://go.microsoft.com/fwlink/?linkid=30076


The tool mentioned in the 2nd bullet item only lets you decrease the MaxReceiveInterval to 100. To decrease it to 50, you will need to run the following SQL command:

use BizTalkMgmtDB
go
update adm_serviceclass set maxreceiveInterval = 50 where id IN (1,2,3,4)
go
Reading the information above, you might wonder why this wasn't set this way from the beginning. I found a web page where Scott Woodgate says...

Tuning for Low Latency

It is possible to get sub-second transactions. BizTalk is built for throughput and not latency. At 50-60% CPU utilization, latency goes through the roof. If you can aim for 30-50% CPU utilization you can still attain low-latency.

The MaxReceiveInterval setting controls the latency of each message and HttpBatchSize can be set to 1 to guarantee each message gets processed as it comes in. Lastly, PollingInterval can set to 50-100ms to force frequent polling of the message box to achieve low latency.


so it seems the default settings are configured to process batches of messages, not blazing fast responses to single messages

Wednesday, March 16, 2005

Code Camp 3 Presentation

I just gave a presentation at Code Camp 3 and the material should be posted eventually at the MSDN code camp downloads page. When that happens, I'll post a notice here.

Topic of my session...
Using the Microsoft Patterns & Practices Enterprise Library
The just released Enterprise Library from the Patterns & Practices group at Microsoft provides assistance in many facets of enterprise class applications - security, logging, caching, error handling, cryptography and data access. This session covers the benefits of using these application blocks, how to incorporate them in your development practices and what can be learned from them even if they are not applicable to your project.


If you attended and have any questions on the topic, fee free to email me personally and I'll try to answer all questions here. In the meantime, I'm going to be posting some quickstart tutorials on this site soon.

Thursday, March 03, 2005

Be careful about server names (avoid underscores)

Helping out an old friend and former co-worker, we ran into an issue where he was unable to save anything in session state between requests in ASP.NET.

Well, we eventually figured out the issue - his server had an underscore in the name....

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

PRB: Session Variables Do Not Persist Between Requests After You Install Internet Explorer Security Patch MS01-055

SYMPTOMS

After you install security patch MS01-055 for Microsoft Internet Explorer 5.5 or 6.0, you may encounter the following problems:
Session variables are lost.
Session state is not maintained between requests.
Cookies are not set on the client system.
Note These problems can also occur after you install a more recent patch that includes the fix that is provided in security patch MS01-055.

CAUSE

Security patch MS01-055 prevents servers with improper name syntax from setting cookies names. Domains that use cookies must use only alphanumeric characters ("-" or ".") in the domain name and the server name. Internet Explorer blocks cookies from a server if the server name contains other characters, such as an underscore character ("_").

Because ASP session state and session variables rely on cookies to function, ASP cannot maintain session state between requests if cookies cannot be set on the client.

This issue can also be caused by an incorrect name syntax in a host header.
I guess you do learn something new everyday.
This took a long time to figure out. It wasn't until he noticed that using numeric IP's worked that he found this article.
He installed the 1.0 .NET framework on the Windows 2003 Server, so I assumed it was related to that. But the issue occurred under both the 1.0 and 1.1 runtime.

For now, he is going to use cookieless=true session state to get around this issue until the servername can be changed.

Wednesday, February 09, 2005

How to tell if sp1 for BizTalk 2004 has been installed already

The Microsoft readme that comes with sp1 for BizTalk Server 2004 does not specify how a user can determine whether the service pack is installed already.

From what I've been able to determine, the quickest way is to fire up regedit and check if the following key exists. If it does, then sp1 has been installed.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\BizTalk Server\3.0\SP1


Tallan Press Release - Evolution Benefits

My company (Tallan) just sent out this press release that discusses our successful relationship with Evolution Benefits.

http://biz.yahoo.com/bw/050209/95077_1.html

Evolution Benefits addresses the main problem I have with Flexible Spending Accounts (FSA) - how to get reimbursed. Right now, the process involves paying twice (through payroll deduction and again at point-of-service), saving and submitting receipts, completing and mailing claim forms, waiting for reimbursement and cashing checks.

This is done by providing a debit card that deducts from your FSA or HSA account whenever you need to make a copay or deductible/coinsurance payment.

Monday, February 07, 2005

Hiding and showing rows in IE and Mozilla/FireFox

One issue that a web developer may run into is how to toggle hiding/showing a row in an HTML table using JavaScript that works in both sets of browsers: Internet Explorer and Mozilla/FireFox/Netscape. In IE, you can set the style.display to "none" for the row, but this doesn't work in Mozilla.

One approach that woks in both browsers is to dynamically assign the class for the row using the following css styles:

<style>
.hide {display: none;}
.show {display: table-row;}
</style>

And here is the entire html for a test page that demonstrates using this approach....

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>

    <head>

        <title>Hiding tables rows in IE and Mozilla!</title>

        <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">

        <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">

<style>

 

.hide {display: none;}

 

.show {display: table-row;}

 

</style>

 

<script>

 

var myBody;

 

function start() {

    // get a list of all the body elements (there will only be one)

    myDocumentElements=document.getElementsByTagName("body");

    // the body element itself is the first item of the list

    myBody=myDocumentElements.item(0);

}

 

function hideRow() {

    mytable=myBody.getElementsByTagName("table").item(0);

    mytablebody=mytable.getElementsByTagName("tbody").item(0);

    myrow=mytablebody.getElementsByTagName("tr").item(0);

 

    myrow.className="hide";

 

 

}

 

function showRow() {

    mytable=myBody.getElementsByTagName("table").item(0);

    mytablebody=mytable.getElementsByTagName("tbody").item(0);

    myrow=mytablebody.getElementsByTagName("tr").item(0);

    myrow.className="show";

 

}

</script>

 

    </head>

    <body onload="start()">

        <P>Hiding tables rows in IE and Mozilla!</P>

 

        <TABLE border="5" ID="Table1" >

        <tbody>

            <tr >

                <td >cell is row 0 column 0 </td>

                <td >cell is row 0 column 1 </td>

            </tr>

            <tr >

                <td >cell is row 1 column 0 </td>

                <td >cell is row 1 column 1 </td>

            </tr>

        </tbody>

        </TABLE>

        <BR>

        <INPUT id="cmdHide" type="button" value="Hide Table Row" name="cmdHide" onclick="hideRow()">

        <INPUT id="cmdShow" type="button" value="Show Table Row" name="cmdShow" onclick="showRow()">

    </body>

</html>

Monday, January 31, 2005

Working with the primitive data types in BizTalk expression editor

If you work with primitive data types (String, Integer, DateTime, etc.) in the expression editor in BizTalk, you might naturally assume they have all of the functionality you find in C# and the .Net framework. It looks like C# so it must be C#. Then I noticed that the types did not support invoking methods on them like in standard .Net.

So you might define variables such as: myString as string and myNum as integer. You cna do the following:

myString = "123";
myNum = System.Int32.Parse(myString);


but you cannot do the following:

myString = myNum.toString();

You can work around this by using the static methods available...

// format as a 11 digit padded number.
myString = System.String.Format("{0:00000000000}", myNum);


What is also unusual is that DateTime and Timespan doesn't have this restriction, so the following is allowed.

TransDate = System.DateTime.Now;
TimeStamp = TransDate.ToString("yyyy-MM-dd-HH.mm.ss.ffffff");


This post from Charles Yound explains how XLANG/s differs from C# in other ways...
http://geekswithblogs.net/cyoung/articles/3820.aspx

Friday, January 21, 2005

How to send SOAP headers in BizTalk

Here are the steps to set SOAP headers in a web service request using BizTalk Server 2004 (BTS).

1. Make sure your web reference in your BTS project is up to date.

2. Open the Reference.xsd for the wsdl of the web service. Look for the name of the root node for their Soap Header. Here is the example I'm using...

<soap:Header>
<AuthenticationHeader xmlns="http://www.acme.com/WebService/">
<strUserName>string</UserName>
<strPassword>string</Password>
</AuthenticationHeader>
</soap:Header>



3. Copy the name. Close the file.

4. Create a new item for the BTS project. Select "Property Schema" NOT the regular schema.
- In the properties for <schema>,
Change the target NameSpace to http://schemas.microsoft.com/BizTalk/2003/SOAPHeader
- In the properties for the root node,
Rename the root node the same as the one is step 2 ("AuthenticationHeader")
Change the Property Schema Base drop-down to "MessageContextPropertyBase"

5. Save the file as "SoapHeader.xsd" and Close the file. (Update: It doesn't matter what the name is as long as the TYPE NAME property of the xsd file is not the same as the root node name. Otherwise, you'll run into a compilation error)

6. Go to your orchestration. There should be a Construct Message shape that creates the web service request. There should be a shape inside of it - either a Transform or a Message Assignment.
If it is a Transform, add a Message Assignment below that in the SAME Construct Message shape.
If it is a Message Assignment, do nothing as we will reuse the existing one.

7. Edit the Message Assignment from step 6 and add the following as one line....

SampleWS_Request_Msg(MyBizTalkProject.AuthenticationHeader) =
"<ns0:AuthenticationHeader xmlns:ns0=\"http://www.acme.com/WebService/\">
<ns0:UserName>MyName</ns0:UserName>
<ns0:Password>NotSoSecretPassword</ns0:Password>
</ns0:AuthenticationHeader>";

Where
- "SampleWS_Request_Msg" is the message variable name in the Orchestration for the external web service.
- "MyBizTalkProject" is your project name
- "AuthenticationHeader" is the name of the property schema

Note: Once you type the message name and the first parentheses "SampleWS_Request_Msg(" an intellisense drop-down list appears and the property schema you are looking for should appear.


Note 2: There is another option to use an existing SOAP header from another message, but I had to use this approach as the incoming message was a Flat File.

Note 3: If you are using SOAP over standard HTTP, please keep in mind that the above message contents (including SOAP Header) can be clearly viewed by others monitoring internet traffic. I don't advocate this as a security measure - but since this is not my web service, I have to play along.

Wednesday, January 19, 2005

Don't use "transaction" as the name of your root node in an XML schema

Especially if you ever hope to integrate with someone who uses BizTalk. Apparently, "transaction" is an XLANG/s reserved keyword in BizTalk 2004.

This is the type of error to expect in BizTalk...

MyOrchestration.odx(92,52):
error X2254: unexpected keyword: 'transaction'
error X2011: expected 'identifier'
error X2016: unexpected token: '.'
error X2157: '': a part of a non-method messagetype must be of class type


See this msdn article for all of the XLANG/s reserved keywords...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/ebiz_prog_orch_nozn.asp

This also led to me figuring out what that language is that BizTalk uses in the expression editor...

Comparing XLANG/s and C#

Tuesday, January 18, 2005

BizTalk - AssemblyName context property was not valid

I've been working in BizTalk Server 2004 for a while now, so I'm going to be publishing some of the most difficult BizTalk problems I have solved...

Here is one particular error
AssemblyName context property was not valid
or
Microsoft.XLANGs.Core.XlangSoapException: An error occurred while processing
the message, refer to the details section for more information
at Microsoft.BizTalk.XLANGs.BTXEngine.BTXPortBase.VerifyTransport(Envelope env, Int32 operationId, Context ctx) at
Microsoft.XLANGs.Core.Subscription.Receive(Segment s, Context ctx, Envelope&
env, Boolean topOnly) at Microsoft.XLANGs.Core.PortBase.GetMessageId(Subscription subscription, Segment currentSegment, Context cxt, Envelope& env, CachedObject
location) at SCE_FlatFileTest.SCE_flatfile.segment1(StopConditions stopOn)
at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)Microsoft.XLANGs.Core.XlangSoapExceptionScoped@SCE_flatfile.SCE_flatfile2dfdb796-dafc-4e08-af1d-683128013b6f


This happened in one of Orchestrations that was trying to submit a request/response message to a web service. I added the web reference already and all schemas matched correctly. What was going on?

Well, the port I specified for the web service had the wrong port type. When I created the port I elected to create a NEW port type instead of selecting an existing one - the one that is automatically created when you add a web service. Doh!!!

Once I made that change, the above errors went away.

Thursday, November 11, 2004

Cool use of RSS by videogames

Check out this innovative use of RSS from the Halo 2 guys

http://www.bungie.net/Stats/page.aspx?section=FAQInfo&subsection=FAQs&page=1

"Q: Is there any way for me to display my stats on my own website?

A: For those who are somewhat technical saavy, Bungie.net offers a RSS feed of player stats for Halo 2. You have to first link your gamertag to your .NET Passport and then when you visit the "My Stats" page, look for the orange "XML" icon. This is the link to your RSS feed. You'll only be able to see the link for your own RSS feed however we encourage you to share this link with others so they can watch your Halo 2 career progress. Additional information can be found in the help section. "

Tuesday, August 03, 2004

Wednesday, June 23, 2004

MSN Hotmail is now (or soon will be) 250MB

MSN Hotmail Joins Storage Race

With the sudden uprise in free storage from hotmail, yahoo and gmail - I'm surprised the stock prices for the hard drive manufacturers - Western Digital Corp (WDC), Seagate Technology (STX), Maxtor Corp (MXO) - hasn't received a noticeable uptick?

Monday, May 10, 2004