Jason's profileJason's .NET BlogBlogLists Tools Help

Jason's .NET Blog

My experiences with Microsoft.NET and more
September 03

BizTalk BAM Portal failure and configuration woes

Well ... BizTalk just never fails to surprise me with the "one-thing-after-another" issues which I run into...
 
Symptom ...
I did a fres BizTalk 2009 install on a virtual machine for some PoC deveopment ... went to prepare a demo of BAM and the BAM Portal and when I hit the website it just failed with a generic message.  Well ... as is standard practice at this point it MUST have been something I did wrong ... so I decided I needed to fix the issue by re-configuring the BAM Portal.
 
The First Try ...
For some reason, I had the bright idea that I should delete the BAM Portal web applications and app pool before un-configuring. I did that, restarted IIS and ran the BizTalk configuration tool.  Next, I un-configured the BAM Portal and completed the wizard ... no problems, right? Of course not!  When I went back into the BizTalk Configuration Tool to configure the BAM Portal feature the services accounts and website options were disabled!
 
The Second Try ...
It turns out that the BAM database was still configured to point to the original website even though I had unconfigured that feature.  So, according the this blog post I needed to use BM.exe to remove that configuration information.
 
The Fix...
  1. Open the command prompt and find your way to BM.exe (Program Files\BizTalk ...\tracking\)
  2. Retrieve the current configuration information:
    bm get-config -FileName:"BAM_Config.xml"
  3. Update the config file to remove the reference to the current website:
    <GlobalProperty Name="BAMVRoot">http://blah.blah.remove.this.URL</GlobalProperty>
  4. Update the BAM configuration database:
    bm update-config -FileName:"BAM_Config.xml"
  5. Re-run the BizTalk Configuration Tool and re-configure the BAM Portal feature and you should be good to go

Conclusion...

Nothing in BizTalk is as it seems Wink

August 26

BizTalk Error: Failed to grant permission to execute. (Exception from HRESULT: 0x80131418)

Here is an issue I ran into for BizTalk 2009 when using the WCF-BasicHttp or WCF-WSHttp adapter. 
 
I received the following error:
The adapter "WCF-WSHttp" raised an error message. Details "System.Security.Policy.PolicyException: Failed to grant permission to execute.
 
What was I doing?
What I was trying to do is expose a schema as a web service endpoint so that any calls to that service would dump that message straight to the message box.  Now ... not wanting to expose my internal schema I created a schema definition especially for this service and a corresponding map to map it to my canonical/internal schema.  Deployed the solution.
 
Next, I used the handy BizTalk WCF Service Publishing Wizard to create the .svc and ports, etc.  I then updated the Receive Port to run the map.  When I tested the endpoint I got the above error.  I then removed the map and the test ran succesfully (albeit with my intended map). 
 
What the heck was happening?
Well ... as luck would have it I had quickly ramped up this virtual server environment and put the portal on port 80 which meant WSS was running on port 80.  Upon inspecting the .NET Trust Level for my web application it was set to WSS_Minimal!!! Arggg!  I had spent way too much time on this one!
 
What was the fix?
Just some things to remember when setting up a web application to run a service into BizTalk:
  • Create a separate App Pool running as a user that has permission to the BizTalk Isolated Host (I just ran it as my BizTalk Iso service account as a shortcut)
  • Make sure this app pool is running as classic mode and not integrated mode
  • CHECK THE TRUST LEVEL to make sure it is appropriate ... in my case I just set it to Full Trust to get it through my test
  • Don't for get to enable the receive location, it is not enabled by the wizard ... you couldn't imagine how many times I forgot to do this while trying to figure out why my darn service isn't working again!

Well ... hope this helps someone else!

May 26

Visual Studio Team Test: Web Tests and IE8

I ran into an interesting problem while trying to create a demo for Visual Studio 2008 using the Web Test macro recorder (IE plugin) and Internet Explorer 8. 
 
The test website I had was on my local PC so I started recording and typed in the localhost address.  Suddenly, the macro recording stopped and only had a message stating the the recording had to be initiated via Visual Studio.  Also, the recording had stopped within Visual Studio as well ... no steps were added to the test script.
 
After scratching my head, searching the net, and gazing into the air I realized that IE was switching from the Internet Zone (for the default about:blank page) to the Local Intranet Zone (for my web site).  To fix this, I manually added about:blank to my list of Intranet sites and everything worked as expected.
 
I am not sure if there is any more legit fix to this but this worked fine for me!
April 06

Silverlight 2.0: Creating an Offline Application (Smart Client), Part 1

The following is part 1 of a series of posts for creating an offline application using Silverlight 2.0

Introduction

Once of the alluring aspects of Silverlight is creating an application with a pretty broad reach (cross-platform/browser) using technologies familiar to the “Microsoft Developer” (C#, VB.NET, etc.) together with some common application patterns (smart clients).  This series of posts is intended to plug the gap in creating a Silverlight 2.0 application that completes the “smart client” pattern with occasionally connected (read: “offline”) features.

Problem

Silverlight does have many of the aspects of a “smart client,” such as …

  • Automatic/intelligent installation and update
  • Broad client platform/device reach
  • “Connected” to back-end services (like LOB logic)
  • Use of local resources

… and some added of it’s own:

  • Very small runtime size (~4 MB)
  • Low client requirements (a browser)
  • Declarative programming model (XAML)
  • Rich UI Framework (Rich Internet Application)

However, it currently lacks formalized support for the most prominent feature of being occasionally connected.  Customers, however, are unwilling to compromise and want all of the above, together, without having to learn a new platform and a set of technologies (like Flash, for example).

Silverlight 3.0 promises new features to help in implementing these new features it is not out yet (in Beta at this time) and customers may already have a need for Silverlight today or have existing application in Silverlight 2.0.

Solution

The good news is that, with one exception, Silverlight 2.0 is fully equipped to handle the offline scenario with little additional effort over what may be coming in 3.0 or what you may have today with other Smart Client or Rich Internet Application (RIA) technologies.

The following techniques will be demonstrated in the upcoming series of posts:

  1. Offline, persistent, secure storage: Isolated Storage
  2. Synchronization with back-end services
  3. Detecting the network and connectivity to the back-end services
  4. Re-launching the application while offline

Companies can create fully disconnected application today in Silverlight 2.0 and I’ll walk you thought the process in upcoming posts.  If you would like to see anything specific please feel free to add some comments and I’ll try and incorporate those into subsequent posts.

April 03

Silverlight: Cloud Connected

A few weeks back I delivered a presentation on connecting Silverlight to services (web, SOAP, REST, etc.) as well as some practical real-world offline caching of data. 
 
Here was the actual agenda from the slides:
  • “Wiring” up a Silverlight 2.0 application to a bunch of services
  • Demonstrations of leveraging WCF, ASP.NET Data Services/REST, XML
  • How you can quickly bind data through XAML in a pain-free manner.
  • A glimpse into the designer/developer workflow
  • Some discussions on differences you’ll notice from WPF.
  • A hands-on demo of the tools you’ll use in SL development
  • Some other stuff (LINQ, Lambda expressions, type inference, blah blah blah blah)
  • Working with IsolatedStorage in an attempt to have this thing work offline
The slides and demo code are here: http://drop.io/jagostoni.
January 19

Review of online game trading sites: Goozex, SaySwap, GameTZ

I put up a review of some online game trading sites on AdultGamingEnthusiats.com ... check it out:

Do you have a bunch of old games you want to sell/trade? Gamestop/EB is always an option, but we all know they have some pretty crappy trade in prices. You could always try one of the many online game trading sites. But, which one is best? See this review to get a better idea of what to expect from these online game trading services....

http://adultgamingenthusiasts.com/blogs/age/archive/2007/01/18/review-of-online-game-trading-sites-goozex-sayswap-gametz.aspx
November 16

SOA - Service-Oriented Architecture

I just completed another webinar as part of CEI's .NET Webinar Series. This time, the topic was Service-Oriented Architecture (SOA) with demos using WSE 3.0. You can download the slides and code below and if you have any questions you can either post them here or email myself or Eric directly.

The agenda was:
  • SOA: Definition and Rationale
  • The Shift to Service-Orientation
  • SOA: Best Practices
  • Microsoft Solutions for SOA
Demos include:
  • Contract-first using XML Schema, xsd.exe, and WSDL
  • Policy-based security (WS-Security) and WSE 3.0
  • Schema Rationalization/Canonicalization
  • Perimeter/Referral routing using WSE and WS-Messaging (using SoapHttpRouter)
Downloads:
- SOA Slides
- Demo Code
July 14

Visual Studio Unit Testing an asynchronous event callback

Problem ...
Long title ... simple problem: I am writing automated unit test cases for an asynchronous method call which returns back via an event handler (a callback).

If I had architected the method that I am calling I would have used the standard Begin/End methods to handle the asynchronous calls but I am using a pre-written source code so I need to adhere to its methodology.

Solution ...
Nonetheless, I needed a way to have a TestMethod make the asynchronous method call and then somehow get the results back from the event handler. I was not (am still not) aware of anything built-in to NUnit or Visual Studio Unit Testing to handle this
so I figured I was on my own.

I figured that all I really needed was a way to sleep the test method until the event handler is called and then signal it to continue and analyze the data returned from the event. Signal. I had heard that before when talking about Thread Synchronization ... threading ... that is what the event callback is ... duh. I need a thread signal!

Enter AutoResetEvent ...
Very fortunately for me, .NET has built-in just such a signal using a class called AutoResetEvent (System.Threading). Once I realized this, the code was frighteningly simple. One thread creates the signal object (initializing its state to un-signaled) and waits on it. The second thread sets the signal and the initial thread continues.

Here's some code:

  1. using System.Threading;
  2. using Microsoft.VisualStudio.TestTools.UnitTesting;
  3. namespace MyTests
  4. {
  5. [TestClass]
  6. public class MyTestClass
  7. {
  8. AutoResetEvent _TestTrigger;
  9. DataType _MyData;
  10. [TestMethod]
  11. public void MyTestMethod()
  12. {
  13. this._TestTrigger = new AutoResetEvent(false);
  14. MyAsyncCall();
  15. this._TestTrigger.WaitOne();
  16. Assert.AreEqual(...)
  17. }
  18. private void My_EventHandler(...)
  19. {
  20. this._MyData = result from event handler;
  21. this._TestTrigger.Set();
  22. }
  23. }
  24. }

You can make modifications to this so that the calling method does not wait indefinitely as well as other handy mods. If you come up with anything cool please drop a comment here so everyone can share in your find!

May 19

Atlas - AJAX Programming for the .NET 2.0 Framework

I just completed a webinar on using Microsoft's Atlas framework for creating "AJAX" applications in ASP.NET 2.0.  Despite that one of my demos failed to work (my poor, poor typing skills) the webinar went well.
 
The webinar started with an introduction to AJAX with a little (read: cheesy) demo of AJAX using a text editor and a browser.  The presentation moved into an overview of the Atlas framework and a decription of the client- and server-side architectures and improvements.  Of course, this all included some more cheesy demos (yet representitive) of:
  • Client-Side O-O API
  • Client-Side Declarative XML
  • Server-Side Control Extenders
  • Server-Side Partial Rendering (UpdatePanel)

For anyone that wants them ... here are links to my slides and code:

For more information I recommend you check out the Atlas home page at: http://atlas.asp.net .

April 17

Code Camp: Creating .NET Solutions using OSS

On April 8's Southwest Pennsylvania's Code Camp I presented on creating .NET solutions using open source software (OSS). The demonstration went quite well and I received a very generous response from the audience. Thanks to all who attended and made this first Code Camp quite a success!

The premise of the presentation was to demonstrate that it is completely possible to create .NET solutions (specifically an ASP.NET web application) using free and open source tools. I used a GNU/Linux based laptop (Ubuntu) with the following tools:
  • Mono (gmcs compiler)
  • MonoDevelop
  • DBDesigner
  • Dia
  • OpenOffice.Org (Writer and Impress)
  • GNUnit2
The result of the demonstration was that while it is entirely feasible to live in a .NET world with all free and open source tools your efficiency will not make up (YET!) for the cost of a more integrated and mature toolset. However, the tools I used are progressing rapidly and there is no reason why they can't benefit you now and in the near future. I would recommend evaluating the cost of ownership ranging through your server environment, development environment and office environment.

The slides, code and documents are all freely available for download here. Use them however you want (at your own risk, of course ).

If you have any questions or comments please feel free to drop a comment on this entry!
April 10

SharePoint Redirect using only IIS

Here is a quick solution to an small issue we had here at work...

One of our internal users (of our SPS instance) wanted to redirect an old list to a new list. I did not want to create a code-based solution (e.g. an aspx page, et al) and with the friendly "Apache could do this" jabbing I got from this guy I decided to see if IIS would handle it. And it did ... really easy:

Example:
Redirect http://mysite/sites/Department/IT/oldlist to http://mysite/sites/Department/IT/newlist

  1. On the filesystem in your webroot, create a folder structure mimicking the URL:
    c:\inetpub\sharepointroot\sites\Department\IT\oldlist
  2. Open IIS Management console and locate that folder
  3. Right-click on that folder and select properties
  4. Use the "A redirection to a URL" option in the Directory tab
  5. Enter the new URL (absolute OR relative) in the Redirect To: box
  6. Test it

All other sites in that path should remain untouched by IIS but since IIS processes this redirection prior to running the ISAPI filter/extension (e.g. SharePoint) then there is no need to even unmange this path from within SharePoint itself.

Simple. Clean. Quick. Even an Admin can do it!
April 02

Southwest Pennsylvania Code Camp

On April 8, 2006, we will be having the first (as far as I know) Code Camp in Pittsburgh. As both an organizer as well as a presenter, I encourage everyone in the area to attend this free event.

There are no corporate sponsors and all of the presenters are from the community doing presentations and demos for the community. There will be free lunch (I think) and plenty of free information!

For more information, please check out the Code Camp website:
http://www.pghdotnet.org/CodeCamp/default.htm.

My presentation will be on creating .NET solutions using free/open source tools! It was interesting to create the demo so I hope that remains when I actually give the presentation.

February 17

Getting and Setting a SecureString in .NET 2.0

SecureString Class
A nice new addition to the .NET 2.0 Framework is the SecureString class making it safe to store sensitive information in memory (e.g. passwords, connection strings). This class takes care of encrypting this information but the class does not provide a very straightforward method for getting and setting its value.

Since the actual value of the string is NOT stored in the memory space of your process it is not really a "managed" value so a bit of marshaling is required to work with it.

Setting a SecureString's value
Fortunately, it is rather easy to set the value of a SecureString ... but it has to be character by character. I assume the reason for this is because you really should not be using any transient/temporary variable to load the data into the SecureString. That would pretty much defeat its purpose. However, there will come a time when you want to set the value of the SecureString FROM another string. That much is simple:

SecureString securePassword = new SecureString();
string insecurePassword = "password";

foreach(char passChar in insecurePassword.ToCharArray())
{
    securePassword.AppendChar(passChar);
}



The above code simply iterates through the characters in the string and appends them to the SecureString.

Getting a SecureString's value
It is as difficult, however, to retrieve the value from a SecureString as it was simple to set it. Since the value of the SecureString is not in the application's process space your code has to interact with it via a pointer to a BSTR:

IntPtr passwordBSTR = default(IntPtr);

try {
    passwordBSTR = Marshal.SecureStringToBSTR(securePassword);
    insecurePassword = Marshal.PtrToStringBSTR(passwordBSTR);
} catch {
    insecurePassword = "";
}


This code uses the Marshal static class to retrieve the value of the SecureString into a BTRS and returns its pointer. Next, again using the Marshal class to reads the BSTR into a managed string vairable to be used at will.

Is this secure?
No ... not really. It should be apparent by now that you are taking the value out of a secure, encrypted memory location and putting it right back into an insecure, unencrypted location.

January 26

SQL 2005 Reporting Services and Sharepoint Web Services

Introduction
One nice addition to SQL 2005 Reporting Services is the ability to have a XML Data Source (e.g. Web Service). However, getting it to work seems to be a little trickier than need be, especially for SharePoint's web service.

The Problem
Following the example in the SQL Books Online makes it look like you can apply it to just any web service but you'll end up fighting with the parameters if you do as they simply don't get properly serialized. After researching the issue and combining several different answers it comes down to the XmlDP Query syntax. The syntax which works looks like this (using GetList as an example):
<Query>
   <Method Namespace="http://schemas.microsoft.com/sharepoint/soap/"
                    Name="GetListItems" />

   <SoapAction>
      http://schemas.microsoft.com/sharepoint/soap/GetListItems
   </SoapAction>
</Query>

The difference from the books online is the <Method> node which seems trigger something in RS to handle the issue. One other note is that even with the Method node, SSRS is still picky about the parameters so I have pretty much gotten by using only the essential parameters. I haven't really built upon this example too much further but feel free to leave a comment if you have.

The Recipe
The following instructions assume an existing report but they should still work just fine using the add report Wizard.
  1. Add a new Data Source
    • Set the Type to XML
    • Set the Connection String to the URL of the web service:
      Example: https://localhost/_vti_bin/Lists.asmx
  2. Set the Command Type to Text
  3. Set the Query string using the syntax above
    Example:
    <Query>
    <Method Namespace="http://schemas.microsoft.com/sharepoint/soap/"
    Name="GetListItems" />

    <SoapAction>
    http://schemas.microsoft.com/sharepoint/soap/GetListItems
    </SoapAction>
    </Query>
  4. Set the parameters in the Parameters tab
    • Use the param name from the WSDL
      Example: listName
    • Use a list name for the value
      Example: Events
  5. Close the dialogs and run the report
You should now have at least some data coming back. If you have any specific problems and/or fixes please feel free to post a comment.

October 07

InfoPath stops loading drop-down values from data connection

A very strange problem indeed ...
 
We have an InfoPath (SP1) form the has a handful of drop-down lists each of which gets its values from a secondary data source.  This data source, in turn, gets its data from a web service.  Very straightforward and very "working."  That is, until it randomly stopped working.
 
We could not figure out why it stopped as we hadn't made any major changes.  Although, we did frequently update the data connection between dev and deployment servers so we thought the constant back-and-forth somehow screwed up the various XSDs and XSLs that are in the InfoPath solution.  Given our assumption, we deleted the data connection and replaced it (no dice) then deleted the drop-downs and the data connections and still no luck.  As a last ditch effort we reverted back to an older version of most of the files, deleted all binaries, cleared all cahces.  Same behavior! What the ....
 
After many many many hours of trying different combinations of everything we could think of ... I decided that we needed to re-create the view.  However, there are well over one hundred fields on this form so doing this from scratch was simply not an option.  So, on a whim, I created a new view, cut/pasted the default view's content to the new view, deleted the old view and made sure the new view was set as the default view.
 
Now everything works fine. Go figure!
October 06

Events not firing for controls in the HeaderTemplate of a Repeater

Problem
At a client's site, we were making extensive use of Repeater controls to render data piped to it via a custom entity and collection.  In addition, we wanted to implement sorting in the repeater using LinkButtons which were rendered in the HeaderTemplate of the Repeater.  So for so good ... seems like a pretty reasonable request and it works. 
 
In addition to this, we also hosted these Repeaters (amongst other UI elements) in a UserControl so that we could take advantage of the WYSIWYG design features of Visual Studio.Net.  These UserControls, in turn, were to be re-used in several aspects: hosted on ASP.Net web pages, loaded dynamically into server controls, and loaded dynamically into SharePoint WebParts.  The last was the most important as prior to ASP.Net 2.0 there are no easy WYSIWYG methods for creating WebParts so we decided to host UserControls inside WebParts.
 
At this point, the UserControls worked just fine when hosted on an ASP.Net web page leading us believe everything was ok.  We dropped the user controls onto the test web page and used the Page_Load event to pass data into the control to be rendered.  The LinkButtons that were in the header of the Repeaters re-sorted the data and everything looked great.
 
Next came the WebParts
At this point we created WebParts that were designed to host the UserControls and pass along any personalization and configuration properties from SharePoint's Storage to the UserControl.  Again, everything appeared to be working great with one exception: The LinkButtons were no longer sorting!  I figured it had something to do with the fact that I was lazy and did all of my work in the RenderWebPart method (no need to lecture me; I have learned my lesson).  I moved the call to Page.LoadControl to the CreateChildControls() method where it should have been the entire time.  This would assure that the UserControls were created and added to the Page's collection in time for the events to fire.  Almost there....
 
Still ... the events did not fire but I still had a little bit of laziness left in me.  My thoughts went back to when I gave SharePoint WebPart development training.  In my own words were: "You should create the controls in CreateChildControls, load them in the Load event of that control, and ONLY render them in RenderWebParts."  Of course, there is a reason for this which I now realize. 
 
In a Repeater control, the HeaderTemplate (and FooterTemplate) is not created until the DataBind event is called and, thus, any controls in the template will not exist until that happens.  In my laziness I had not moved the actual loading of the data in the UserControl out of the RenderWebPart method so while the control itself was getting added to the controls collection at the correct time, the LinkButtons did not exist.  Following my own advice I moved the loading code into the UserControl's Load event (on the web part) and now everything works as advertised.
 
The Moral
Having passed my ASP.Net MCP ... I should have known better.  Having uttered the words in training that would have prevented this from being a problem in the first place ... I should have known better.  Being lazy at the wrong time ... priceless.
August 22

Oracle 9i Client and System.Data.OracleClient

If you haven't yet upgraded to a newer Oracle client (e.g. 9.2) or you are having problems with your current Oracle client (9i or higher) then you will need to take a few steps to make your client work as you might expect.  There are two main considerations:
  • TNSNAMES.ORA must be local
  • Permissions must be reset on your client directory
tnsnames.ora
Typically, companies will centralize the tnsnames.ora files (used for resolving Oracle service names) but putting it on a fileserver and pointing to it in the registry.  This works just fine for Oracle's toolset and many other client programs with the exception of the System.Data.OracleClient ADO.Net provider.  The provider, for some reason, expects this file to be installed locally (example: c:\oracle\ora92...\tnsnames.ora).  Installing (and perhaps mirroring from a network share) locally will take care of the first requirement.

Permissions
For some reason, the permissions for the "Authenticated Users" user is not fully propagated throughout the Oracle client install.  The fix for this is straightforward as well:
  1. Open Explorer to your client install directory (c:\oracle\ora92)
  2. Right-click ora92 and select propertied
  3. Select the "Security" tab
  4. Select the "Authenticated Users" entry
  5. Uncheck the "Read and Execute" attribute
  6. Click Apply
  7. Re-check the "Read and Execute" attribute
  8. Click Ok
  9. Reset IIS
At this point the Oracle provider should work!

August 11

Proper source code management of your Visual Studio 2003 solutions

Source Control, and thus products like Visual Source Safe or CVS, is obviously an important part of your software development life cycle but can also be a source of frustration (especially for ASP.Net web projects).

It is important to have a standard, repeatable method for any process in your SDLC including your project structure and source code management. Visual Studio makes this even more important for ASP.Net projects given it's natural tendency to put all of your web projects under wwwroot. While this is a perfectly acceptable solution for some teams, many prefer to have their entire project under one folder structure. Reasons for this range from obsessiveness to easy of backup to convenience. Below is a good (mission tested) method for source code management in Visual Studio.

Step 1: Decide on your folder structure in advance
Through experience, anecdotal and empirical evidence, common sense and (of course) trial and failure many people in the industry have come to agree that to following folder structure just makes sense.

...\SystemName\SolutionName\ProjectName

System Name represents an overall name for your system (like EcommercePortal) and allows you to group not only more than one Visual Studio.Net solution but other components of your project as well (documentation, diagrams, etc.). Solution Name corresponds directly with the name of your VS.Net solution. If the folder does not represent a VS.Net solution then common sense prevails on your naming and hierarchy from this point on. Finally, Project Name is simply the name of your VS.Net project where the solution folder can have one or more projects in this branch.

The root location of this structure does not initially matter (e.g. on team member can use d:\SystemName... while another uses his My Documents folder); However there are certain cases where the full physical path makes a difference. InfoPath projects, for example, become much more easily managed if all team members are using the exact same physical path.

Step 2: For ASP.Net web projects, pre-create your folder structure
At this point, if your solution is going to contain one or more ASP.Net web projects you should create the folder structure in advance in preparation for the next step. The following would be an example of a full folder structure for an Ecommerce web front-end:

c:\Projects\EcommercePortal\EcommerceSolution\EcommerceWeb


Please note: In Visual Studio.Net 2003, the folder and project name of your ASP.Net web project must match the name of the web (virtual directory) under IIS. This is a good time to choose a logical name for your web application before you have added any value.


Step 3: For ASP.Net web projects, create your virtual directory
Normally, VS.Net would create all ASP.Net web projects (new or from Source Safe) under the default website's directory (usually c:\inetpub\wwwroot). However, it is often desired to keep all of your project files in a single folder structure. To coerce VS.Net to create your web application within this folder structure you simply need to setup a virtual directory with the same name as your web project and folder. In above example, you would create a virtual directory named EcommerceWeb pointing to that directory.

The easiest way to create a virtual directory is to do the following:

  • Locate the physical folder user Explorer
  • Right-click the folder name (EcommerceWeb) and select Properties
  • Click the Web Sharing tab
  • Click Share this folder and accept the default settings
  • Click OK until all property dialogs are close

Step 4: Create your solution

At this point, you can finally begin creating your Visual Studio.Net solution that will contain your projects. Using Visual Studio, create a new Blank Solution, name it appropriately, and save it in the directory you created above. Continuing this example, your solution file should be created as follows:

c:\Projects\EcommercePortal\EcommerceSolution\EcommerceSolution.sln

Step 5: Add the empty solution to source control

Now that you have your folder structure and blank solution you can start putting it into your source control system. This will pre-create the structure you have so far and make the rest of the processes a little bit simpler. The following list demonstrates this using Visual Source Safe:

  • Right-click the solution in your Solution Explorer and select "Add Solution to Source Control ..."
  • Assuming no previous structure exists under VSS:
    • Single-click the root ($/)
    • Enter your system name (Ecommerce) into the text box and click create
    • Single-click the newly created project (Ecommerce) and click OK
  • If your system/project already exists under source control, simply select the system name and click OK

Note: VS.Net will automatically create a sub-folder/project for your solution directory (EcommerceSolution) so there is no need to create or select this in your source control dialog.

Step 6: Create your project(s)

You can now add projects to the solution as you normally would with one note: For ASP.Net projects make sure that you name your project the same as the virtual directory you created above. If you are prompted, check out your solution file.

Step 7: Bind your project to source control

With the exception of ASP.Net projects, your solutions will be properly created under the solution directory when you check them into source control. However, ASP.Net projects will not be created where you anticipate. The following instructions will re-bind your ASP.Net project under the correct hierarchy:

  • Open your source control client
  • Under the solution folder/project (EcommerceSolution) create a new folder/project with the same name as your ASP.Net project (EcommerceWeb)
  • Back in VS.Net
  • Click File->Source Control->Change Source Control
  • Click on the link for your web project (EcommerceWeb)
  • Click the Bind button
  • Select the folder/project you just created (EcommerceWeb)
  • Click Ok Twice
  • If prompted, select "Continue with these bindings"
  • If prompted, allow VS.Net to check-in any files
  • In your Solution Explorer, check-in the entire solution

Final Step: Getting the source tree from source control

You now have your entire system, solution, and projects checked into your source control system in a manageable hierarcy. However, there is still one more precaution the rest of your team needs to take before they begin working with this system: they need to get the entire source tree back out of source control without undoing any of the above steps.

The safest and cleanest way of getting the source tree is to follow Steps 2-3 above, then use Visual Studio.Net's "Open from Source Control" wizard (under File->Source Control). You will need to navigate down to folder/project where your solution is under source control and make sure your local path in the dialog matches what you created in Step 2.

Another method is to use your source control client to get a local copy of the source tree (outside of VS.Net) and then create your Virtual Directories (as in Step 3) for your web projects BEFORE you open the solution in VS.Net

August 02

Checking in BizTalk file before editing can corrupt the file

We've all been there...
When you are working with a team of developers (whether two or ten), who are collaborating on a project in Visual Studio.Net, there certainly is the chance that you will need to add a new file to the solution.  Of course, to do this you have to check out the project file locking it for yourself.

Play Nice!
The courteous thing to do (karma, right?) is to add your file and immediately check in the new project file with your newly added file (as long as it doesn't break the build :) ).  Try doing this in BizTalk sometime (if you already haven't) and watch the quick destruction of your file.  Once you start editing that file again and check it back in you get a nice little warning about the encoding type changing.  Visual Source Safe does not handle this very gracefully; Visual Source Safe does not handle this at all.  You will be fooled into thinking your file is safe because you are working with the version on your local disk but the next time one of your team members gets the latest version of your project the file will be toast.

What the ...?
The issue here is that when you create new files in VS.net it likes to create them as UTF-8 encoded files.  Seems like a good idea; a nice standard encoding type.  BizTalk, however, has to be different and save everything as UTF-16.  Once again, another nice, standard format.  However, visual source safe is completely oblivious to the change in encoding types an will gladly assume that your are still managing a UTF-8 encoded file.

The Moral
You can still be a gracious team member and have a quick turn-around on adding new files to the project but just give those files a little edit first before you check everything in.
July 26

True != true ... duh!

Ok ... so once again one of the simplest of errors put me into out-thinking-myself mode.  Simply put, when you have a boolean in an XML file that goes into a BizTalk Orchestration, it is case-sensitve.
 
So if you get an error stating that you have invalid text for your System.Boolean type then now you know: "True" is not true ... "true" is true.
 
Put this on under the "duh" category.
July 24

Using Jalindi Igloo plugin (CVS) with VS.Net ... successfully

If you need to use CVS for source code control on your Visual Studio.Net project, here is a quick way to enable the latest version of CVS in combination with the free Visual Studio.Net add-in: Jalindi Igloo.
The plugin does have it's own install program and scripts but the problem is that it uses an older CVS library and does NOT work well with SSH connections to a CVS repository. While the older version may work well for you, I certainly suggest you always use the latest CVS client for at least security reasons.
First, download all of the following packages:

Next, install the CVSNT client as you normally would making sure to note the location of the install directory. Once that is installed, open the beta version Igloo archive and copy the files into the CVSNT directory (ignoring the paths). But first, please note:

*** DO NOT OVERWRITE ANY FILES IN THE CVSNT DIRECTORY ***

The beta igloo client has some older CVSNT files and you don't want to mess up your install. After that, you just need the nice VBS scripts provided with the release version of Igloo. One script will register the plugin as your SCC provider in VS.Net and the other will restore SourceSafe as your client.

Problem naming a BizTalk operation ReceiveMessage or SendMessage

Here was a strange one that took me a while to nail down.  First, the error messages:
The keyword new is required on 'Microsoft.Samples.BizTalk.SendMail.ReceivePortType.ReceiveMessage' because it hides inherited member 'Microsoft.BizTalk.XLANGs.BTXEngine.BTXPortBase.ReceiveMessage(int, Microsoft.XLANGs.Core.Envelope, Microsoft.XLANGs.BaseTypes.XLANGMessage, Microsoft.XLANGs.Core.Correlation[], Microsoft.XLANGs.Core.Context, Microsoft.XLANGs.Core.Segment)'

'Microsoft.Samples.BizTalk.SendMail.ReceiveSend.ReceivePort' denotes a 'field' where a 'class' was expected
Static member 'Microsoft.Samples.BizTalk.SendMail.ReceivePortType.ReceiveMessage' cannot be accessed with an instance reference; qualify it with a type name instead
'Microsoft.Samples.BizTalk.SendMail.ReceivePortType.ReceiveMessage' denotes a 'field' where a 'method' was expected
After searching for a few hours on the Internet for that one and playing around with recent changes I had made I finally had realized what I did:  I was getting a little too creative for my own good (or not creative enough, perhaps). 
 
I decided that Operation_1 and Operation_2 were not good names for my receive and send ports so I decided to name them something else.  Of course, in a burst of creativness I used 'ReceiveMessage' and 'SendMessage' for the names.  I had done that a while back but apparently never did a build as I made several other changes since.  Then I compiled and got the errors above on the receive port.
 
Figuring it had something to do with the ports I decided to just nuke them and recreate them.  I used my usual internal justification that Microsoft's software had somehow screwed up my code (uh ... it never turns out that way).  After doing this everything compiled just fine once again.  Ah Ha! It was Microsoft screwing up my code! Then I immediately went and renamed the ports once again to my ever-so-creative names and boom. 
 
DOH!
 
Moral: Either get very creative with your naming or have a complete lack of creativness altogether.  Don't sit in the middle.
 

Jason Agostoni

Occupation
Location