Deploying a WCF Service to AppFabric

In a previous post, I build a very simple WCF Workflow Service Application which leveraged the Beta BizTalk 2010 WCF LOB adapters.  You can read more about that here.  In this post, I will walk you through deploying the test application to AppFabric.

Here is a quick overview of the steps.

  1. Configure your project to create a deployment package
  2. Create the package
  3. Import the package into AppFabric
  4. Change the application pool so I can authenticate with the database
  5. Test the service
  6. Quick tour of AppFabric

First, lets take a look at the test application I built in my previous post.

image

Pretty simple stuff, receive a message, call the WCF LOB adapter for SQL to execute a query, then return the results to the client.  We tested this and it works just fine within our development environment, time to deploy this to AppFabric.

First, you need to setup your application and determine how you want to deploy.  View the properties for your application and take a look at the Package/Publish Web tab.

image

I am choosing to create a deployment package.  This simply zips everything up for you.  Once you have the location configured, save your project.

To create the deployment package, just right click on your project and select the Build Deployment Package.

image

In a few moments the package has been built and is located in the configured location.

Next I open IIS Manager and import the package.  I am going to deploy this to my default web site so I simply right click the web site and select Import Application from the Deploy menu.

image

This kicks off the Import Application Package wizard.  It lets you browse for the deployment package, gives you information on what is in the package, lets you make some configuration settings, etc.  Once you are done, you will have deployed your service.  Notice in the top right of the window that AppFabric is showing one service.  If you don’t see this, refresh AppFabric. 

Below is the AppFabric Dashboard.  This is a quick way to check the health of your services as well as view other metrics.

image

I can get information about the service.

image

I can view and even manage an endpoints.

image

I also have a host of configuration options provided by AppFabric.

image

Now that the service is deployed, time to test it.  I point WCF Storm at my service, enter some data, and invoke it.  I get an exception.  So, what is happening.  The service is running under the ASP.NET application pool which isn’t running with credentials which allow access to my database.

image

In order to fix this issue, I created a new app pool with specific credentials, and then configured my service to use those credentials.

image

Once done, I invoke my service again using WCF Storm and receive a valid response.

image

AppFabric is a great hosting environment for your services.  Here is another look at the dashboard.

image

This gives you a quick overview of the running services.  Note that I have 5 successful calls and one failed call.  If I expand the WCF Call History section I can get more information.

image

Clicking on the calls failed link gives me a list of failed calls where I can get detailed information about the exceptions.

image

I can also get information about successfully completed calls.

image

If that isn’t enough.  All this information is stored in SQL.  So I can create my own dashboard if Idon’t like the one AppFabric provides or if someone without access to the dashboard needs the information.

image

A quick recap.

  1. I configured my project to create a deployment package
  2. I created the package
  3. I imported the package into AppFabric
  4. I changed the application pool so I can authenticate with the database
  5. I tested the service
  6. We took a quick tour of AppFabric

One of the questions on my previous post was about authentication.  In his scenario, he was using the SAP adapter.  So switching the applicationPool didn’t help him with authentication.  He needs to pickup the login information from someplace before he makes the call.  Not sure if this will be my very next post, but it is something I will write up.

I also want to touch on how to use the BizTalk mapper from within WF as well as some EDI tips and tricks.  Let me know if you have something you would like to see covered.

Posted in AppFabric, WCF, WF

Using BizTalk WCF LOB Adapters within WF

BizTalk 2010 will include functionality which will allow .NET developers to more easily leverage the WCF LOB adapters as well as the BizTalk Mapper.  In this post I will focus on how to build a simple WCF Workflow Service which leverages the WCF LOB Adapter for SQL to query the database.

There may seem like there are a lot of steps, however, once you know what the steps are, this takes about 3-5 minutes to get up and running and requires very little code.  After you have walked through the process, try creating a new project and building it again without following the steps below.

You will need to create a database named ‘Test’ with a table named ‘Customers’.  The table should have three columns, ID, First, and Last.  Fill the table with some sample data and we are ready to start.

Here is an overview of what we are going to do.

  1. Create a new WCF Workflow Service Application.
  2. Generate a WCF LOB Adapter Service Reference which created our Activity.
  3. Change the default data variable and added a new response variable.
  4. Wire up the activities to use our variables.
  5. Tested our application.

To get started, create a new WCF Workflow Service Application.

image

Once your project loads, you should see the Service1.xamlx workflow.

image

Next, lets add our adapter service reference.  Right click on the project and select the ‘Add Adapter Service Reference’ option.  This will open the WCF LOB Adapter dialog.

image

The Add Adapter Service Reference dialog give you access to all of the WCF LOB adapters installed on the Server.  This is the same dialog you will use to generate a .NET proxy class, a BizTalk Schema, or in this case, a WF Activity.

image

Once you have picked the sqlBinding, click the Configure button.  This will open the Configure Adapter Dialog.  This allows you to set the security and URI properties.

For security, we are going to select ‘Windows’ as our credential type.

 image

Next we need to set the URI properties.  We need to set the InboundId, the InitialCatalog, and the Server.  The InboundId is used to differentiate one receive location from another and can be anything as long as it is unique.  The initial catalog is the name of your test database and the server name is simply the name of the server where your database lives.

image

After you click OK, you will need to click the ‘Connect’ button.  This will query the database and pull back meta data.  You browse through the meta data and select the operations you would like to include in your proxy.  In our case, we are going to leverage the select operation on our Customer table.

image

Before we click OK, we need to select an advance option.  We need to have the wizard generate message contracts.

image

The process may take a little while to generate the appropriate artifacts, so be patient.  When the process is complete you will see the following message.

image

You will see two new files within your solution.  A Adapter Binding class file and a xaml file.  The class file contains all the proxy classes, the xaml file contains the activity.

image

To see the activity in the toolbox, you will need to rebuild the project.  Once rebuilt, the SelectActivity should appear.

image

Drag the activity onto the WorkflowService and drop it in-between the ReceiveRequest shape and the SendResponse shape.

image

At this point, we have generated everything we need.  We need to modify a variable, create a new variable, and then wire everything up.  Almost done.

If we take a look at the default variables, we have a handle variable for correlation and a data variable.

image

First we need to change the data variable.  We want to rename the variable to ‘Query’ and change the type to String.  This will cause some errors to appear on our workflow which is expected.

image

To fix the ReceiveRequest error, we need to click on the ‘view message…’ text within the ReceiveRequest activity.  This will open the content definition dialog.  We need to change the message data expression from pointing at the data variable to the ‘Query’ variable and change the message type from int32 to string.

image

This will correct the problem with the ReceiveRequest activity.  Now lets edit the properties on our SelectActivity to leverage our ‘Query’ variable so we can pass the Query we receive from the ReceiveRequest activity to the SelectActivity.

To do this, simply view the properties on the SelectActivity and change the Query property to be Query which is our variable.

Also, set the columns property to “*”.  This will tell the adapter to retrieve all the columns in our table.

image

Time to create the variable which will contain our results from the SelectActivity and be the response message back to the client.  Create a new variable called QueryResult.  Set the Type as Array of [T]. This will open another select types dialog, pick browse for types as your option.

image

This will open a list of available types, we want to pick the Customers Type.  This will set the QueryResult variable as an array of customers.

image

When done, here is what our variables should look like.

image

Go back to the properties on the SelectActivity.  We need to set the SelectResult property to our QueryResult variable.  This will take the response we get from the WCF LOB adapter and pass it into our QueryResult variable.

image

Last step.  We need to change the SendResponse activity to use our QueryResult variable.  To do this you need to click the ‘View message…’ text within the SendResponse activity.  This will open the Content Definition dialog.

We want to set the message data to QueryResult and the Message type to an array of customers.

image

You should be done and your screen should look like the following.

image

If you start the project in debug mode your service will start.  When you browse to the service you should see the following.

image

I typically like to use WCFStorm to test my services.  Once you have opened the service in your test tool of choice, you should see a GetCustomers operation which takes a string as the input. 

image

We want to enter our where clause as our string.

image

After you invoke the service, your response will contain the matching records.

image

Again, lots of steps, but in reality this takes only a few minutes to setup and get working once you know where everything is.

A quick recap.

  1. We created a new WCF Workflow Service Application.
  2. We generated a WCF LOB Adapter Service Reference which created our Activity.
  3. We changed the default data variable and added a new response variable.
  4. We wired up the activities to use our variables.
  5. we tested our application.

In my next post I will show how to package the service and deploy it to AppFabric and show you some of the manageability features provided by AppFabric.

Posted in BizTalk, WCF, WF

BizTalk Server 2010 Public Beta now available!

BizTalk 2010 Beta is now available for download, you can get the bits here.

Why should you be interested?  Here are some of the new features in the product;

  • WF Activities for accessing the WCF LOB adapters and BizTalk maps from within a WF workflow.
  • BizTalk services accessible via BCS for SharePoint 2010 developers.
  • A much improved mapper.
  • Pre-Built RFID components.
  • Simplified Solution Manageability.
  • Easy Install and Migration from previous versions of BizTalk
  • Support for the latest platform versions
  • New B2B management functionality
  • New and updated adapters
Digg This
Posted in BizTalk

May 25th Atlanta BizTalk User Group Meeting

clip_image001


Please join us for the quarterly meeting of the BizTalk Server User Group.

Tuesday, May 25, 2010

5:30 pm – Networking and Dinner

6:00 pm Presentations

Microsoft Office 

1125 Sanctuary Parkway

Suite 300

Alpharetta, GA 30004

Please use the link below to register to attend.

Register Now to Attend the User Group Meeting!  http://www.clicktoattend.com/?id=148767

LiveMeeting Information

https://www.livemeeting.com/cc/microsoft/join?id=JMRG3Z&role=attend&pw=9BRXCS 

Meeting ID: JMRG3Z

Attendee Entry Code:  9BRXCS

Agenda

· Introductions, Agenda, & Grab Food (15 min)

· Technical Presentation: Integrating BizTalk and SharePoint into your Business Solutions (90min)

· Closing questions and suggested topics for the next meeting (15 min)

Topic (new): Integrating BizTalk and SharePoint into your Business Solutions

The focus of the discussion will be integration of BizTalk with SharePoint and the different solutions available to you as an integration developer. We will cover basic integration solutions with WSS 3.0, MOSS2007 Standard Edition and MOSS2007 Enterprise Edition as well as discuss leverage BizTalk as your ESB portal solution. We will show lots of demos and discuss the Atlanta Journal Constitution case study.

About the Speakers

Jeff Jones: Sr. Architect and a Microsoft Virtual TS, Innovative Architects

Jeff specializes in BizTalk EDI, SOA, and EAI solutions with over 10 years of industry experience implementing enterprise applications based on Microsoft technologies for the accounting, auditing, financial, industrial and entertainment industries. In addition to his undergraduate and graduate degree from The University of Georgia, Jeff has a number of Microsoft .Net certifications.

Shawn Chesney: Manager, Software Development and Integration Services, The Atlanta Journal Constitution

Shawn is an IT professional with 13+ years of experience in the enterprise architecture, development and security domains with 8 years specifically focused on enterprise and integration solution development in the sales, distribution, and manufacturing environments.  In his current role, he leads the development, implementation, and support of enterprise solutions.  Shawn’s diverse responsibilities encompassed the development of technical and integration strategies, operational support, application development, IT policies and procedures, and project management and oversight.  In addition, he established an integration strategy consisting of an integration services layer infrastructure based upon BizTalk Server 2009 and SQL Server Integration Services 2008, and led the design and implementation of a Microsoft Office SharePoint Server 2007 intranet solution that included custom branding, Kerberos security integration, workflows and integration with a business intelligence solution.

Brian Mize, Sr. Programmer, The Atlanta Journal-Constitution

A 12-year veteran of the Newspaper industry, Brian has had experience in a variety of industry-specific software packages.  The last two years have seen him expand his skill set to include Microsoft products at a time when the media world is diversifying its own technology.  This diversification has led Brian to embrace BizTalk and the pub/sub method so well embodied in that integration platform.  For the last 12 months, he has been a major player in the integration world of the AJC, performing on all lifecycle levels, from architect through development, testing, and administration of various servers and packages.  While a relative newcomer to the integration world, Brian has enjoyed immediate success and accomplishment by utilizing BizTalk Server, in conjunction with other integration pieces, to tie multiple disparate systems together in a way that eases end-user angst while also lowering executive skepticism over cost/return ratios.

Also make sure to register and find out more information about our group!

Register to Become a Group Member!  http://www.btug.biz

A special thanks to Microsoft our sponsor!

clip_image001[4]

Digg This
Posted in BizTalk, Events

Free Azure Training with two weeks of access

Azure @home is a 2-hr LiveMeeting presentation which will walk you through creating, deploying, and managing your first Azure application.  In addition, the course includes two weeks of Azure access.  You can find more information at http://distributed.cloudapp.net/

Digg This
Posted in Trianing

Application Infrastructure Event

A virtual launch event will kick off on May 20th.  Details below…

Application Infrastructure: Cloud Benefits Delivered

http://www.appinfrastructure.com

Want to bring the benefits of the cloud to your current IT environment? Cloud computing offers a range of benefits, including elastic scale and never-before-seen applications. While you ponder your long-term investment in the cloud, you can harness a number of cloud benefits in your current IT environment now.

Join us on May 20 at 8:30 A.M. Pacific Time to learn how your current IT assets can harness some of the benefits of the cloud on-premises—and can readily connect to new applications and data running in the cloud. As part of the Virtual Launch Event, Gartner vice president and distinguished analyst Yefim Natis will discuss the latest trends and biggest questions facing the Application Infrastructure space. He will also speak about the role Application Infrastructure will play in helping businesses benefit from the cloud.  Plus, you’ll hear some exciting product announcements and a keynote from Abhay Parasnis, GM of Application Server Group at Microsoft.  Parasnis will discuss the latest Microsoft investments in the Application Infrastructure space aimed at delivering on-demand scalability, highly available applications, a new level of connectivity, and more. Save the date!

Digg This
Posted in Events

BizTalk 2009 RFID Process Cycling Issue

I was working on an RFID POC and noticed that my RFID Provider and RFID Process were cycling on a regular basis.  After a few e-mail messages and some research, turns out the issue is due to IIS recycling the process.  The solution is a simply web.config setting change for each affected provider / process.

Cause

If you have logging set to a level where the log files are being updated often or you have a large number of logging statements in your provider or event handler IIS will think it should cycle the process in order to pickup file chances.

You can determine if this is the problem by looking at the shutdowns log file for your provider or your process log file.  The log files are located in the provider and process folders.  If you are looking at the provider shutdowns log file and have this issue, you will see an error stating;

ApplicationShutDownReason = ChangeInGlobalAsax

image

Solution

The solution to the problem is fairly simple.  You can either 1) turn off or reduce logging for the provider / process or 2) you can make a modification to the web.config file in the respective provider / process folder.

While turning off logging isn’t the best solution, it is a great way to quickly test if you have this problem and implement a temporarily fix until you can modify the web.config files.

To fix the solution by modifying the web.config file, you will need to add an httpRunTime element to the system.web section as follows;

<system.web> 
    <!– other config information –>
     <httpRuntime
        waitChangeNotification=”2147483647
        maxWaitChangeNotification=”2147483647
   /> 
    <!– other config information –>
</system.web>

Essentially this tells IIS not to cycle the process.

Special thanks to Kranthi Kumar Mannem, one of the software development engineers working on BizTalk RFID who helped me solve this problem.

Tagged with: ,
Posted in BizTalk, RFID