BizTalk – Error 0x80131700 while starting SSO Enterprise Single Sign-On Service

I’m using BizTalk Server 2006 R2 then after installing .NET 4.0 Framework all services of BizTalk went down. When I tried to start the Enterprise Single Sign-On Service it throws this error:

Windows could not start the Enterprise Single Sign-On Service service on Local Computer.
Error 0x80131700: 0x80131700

When I checked the event log there are more information:

Could not create SSOSQL. To fix the problem, reinstall SSO or try ‘regasm SSOSQL.dll’ from a Visual Studio command prompt.
Error Code: 0x80131700

Solution:

It depends whether you’re using 32bit or 64bit, so please keep in mind before doing ff steps below.

This issue can also be repaired by using the regasm tool to re-register the SSOSQL assembly. Regasm.exe is included with the .Net Framework.

32-bit Server

1.       Open a command window
2.       Go to C:\Windows\Microsoft.NET\Framework\v2.0.50727
3.       Type: regasm “C:\Program Files\Common Files\Enterprise Single Sign-On\ssosql.dll”

64-bit Server

1.       Open a command window
2.       Go to C:\Windows\Microsoft.NET\Framework64\v2.0.50727
3.       Type each of the following and hit ENTER:

32bit:  regasm “C:\Program Files\Common Files\Enterprise Single Sign-On\win32\ssosql.dll”
64bit:  regasm “C:\Program Files\Common Files\Enterprise Single Sign-On\ssosql.dll”

Note On a 64-bit server, regasm will need to be run for both the 32-bit and 64-bit versions of ssosql.dll.

Link to orginal KB Article.

ASP.NET ReportViewer Native compiler return value: ‘[BC2001] file’ error

Recently restored one of our servers and I encountered this error while trying to view a report:

An unexpected error occurred while compiling expressions. Native compiler return value: ‘[BC2001] file …. 

Solution:

1. Solving this seems so easy, first check the identity of the AppPool where the website is running:

2. From the command prompt type: %windir% and look for the temp folder. Add read/write permission to temp folder of windows to user in step 1.

Note: In other cases  the temp folder is located somewhere else, so to check where it’s located go to System Properties -> Advance -> Environment Variables. In the System Variables look  for the TEMP or TMP:

 

 

 

C# Enterprise Library Asynchronous Logging

We all know how slow any logging mechanism is, specially when one of the trace listeners is logging to a database. By using .NET 4.0 with it’s Parallel Library (System.Threading.Task) we can easily turn our logger to use fire-forget asynchronous operation.

 Example below uses Enterprise Library 5.0.

Suppose this is your existing LogMessage method:

Just add another method LogMessageAsync with ff code:

Now to log asynchronously just call the LogMessageAsync() method.

 

 

C# Parallel – Call methods with input and return values

In .NET 4.0 they made it easy to start a task/process simultaneously. Code below shows how you can execute two methods with input and return values simultaneously thru the Tasks Factory in System.Threading.Task namespace.

Note: Add System.Threading.Tasks & System.Diagnostics in the using statement.

Code:

 

 

Output:

EsbToolkit 2.1 – Installation and Configuration Errors (Compilation)

I recently installed BizTalk Server 2010 and EsbToolKit 2.1 and below are the summary of errors and instructions on how to overcome them.

Error:

HTTP Error 404.17 – Not Found
The requested content appears to be script and will not be served by the static file handler.

Resolution:

Be sure that .NET 4.0 is installed, then run the following:  aspnet_regiis -i  in C:\Windows\Microsoft.NET\Framework\v4.0.21006

Error:

HTTP Error 404.2 – Not Found
The page you are requesting cannot be served because of the ISAPI and CGI Restriction list settings on the Web server.

Resolution:

1. Go to Internet Information Services (IIS) Manager, click the {YouComputerName} Home (located  after the Start Page icon).

2. in the IIS Section -> Double click ISAPI and CGI Restrictions -> make sure ASP.NET is allowed.

Error:

HTTPException, Could not load file or assembly ‘System.Web.DataVisualization…

Resolution:

1. Download and install Microsoft Chart Controls for .NET 3.5

 Error:

Could not enlist send port ‘ALL.Exceptions’ in Microsoft.Practices.ESB application (BizTalk Admin Console)

Resolution:

Add new filter expression to it, Property: ErrorReport.FailureCode Operator: Exists

 

Error:

HttpException, Could not load type ‘Microsoft.Practices.ESB.Portal.Global’.  

Resolution:

In the ESB Toolkit installation manual there’s no mention of Enterprise Library but in fact you need to install it. Also, ESB Toolkit uses Enterprise Library 4.1 and not 5.0. Get the installer here. Then rerun the Management_Install.cmd.

Error:

WebException,  The remote server returned an error: (401) Unauthorized. 

Resolution:

1. Click Start, click Run, type cmd, and then press ENTER.

2. Locate the directory that contains the Adsutil.vbs file. By default, this directory is C:\Inetpub\Adminscripts.

3. Type cscript adsutil.vbs set w3svc/1/root/NTAuthenticationProviders “Negotiate,NTLM”

 The number after w3svc is the website id, the script above assumes that the ESBPortal is your first website.

For the complete Microsoft Guide click here.

 

Error:

WebException,  The remote server returned an error: (404 ) not found.  

Resolution:

.svc should be register in IIS, run the following command in command prompt.

“%windir%\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe” -r -y

Error:

Runtime Error, Client found response content type of  ‘text/html; charset=utf-8’, but expected ‘text/xml’

Resolution:

Problem lies with ESB.BizTalkOperationsService, by going to the web.Config of this service then setting customErrors mode to “RemoteOnly”, you can see the actual error which is: Could not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly ‘System.ServiceModel’. 

This error could occur if IIS is installed only after installing .NET 4.0. To solve this type the ff: in command prompt:

%WinDir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis -iru

 

Error:

Management_Install.ps1 cannot be loaded because the execution of scripts is disabled on this system.

Resolution:

Open Powershell Command Prompt (Run as Administrator). Type  Set-ExecutionPolicy Unrestricted

SQL Server 2008 R2 – Error Code 2337 while installing on Virtual PC 2007

While preparing a new VPC image for our new development standards using BizTalk 2010, I’ve encountered an error  during the installation of SQL Server 2008 R2 with error code 2337;  even though the service is installed when I tried to start the SQL Service it throws out a faultexception about sqlsrv.exe.

As it turns out the problem lies with the Capture ISO feature of the Virtual PC 2007 itself, so to solve this I’ve used 7-Zip to extract the contents of iso file then shared the folder and ran it from there.

WCF Using Windows Authentication and SqlRoleProvider over basicHttp

This tutorial is about building a sample WCF Service that makes use of  Windows(Active Directory) as Authentication mechanism and SQLRoleProvider for the Authorization.

1. Lets start by creating a new WCF Service Application. Open VS2010, File New Project under WCF select WCF Service Application. For the name just use the default: WcfService1.

2.  New Project was created, Go to the code of Service1.svc

The goal is: when a client application calls the GetData method, it should have a valid windows account (active directory account) and should be a member of a Role (SqlRole) that we will create later.

Press F6 to compile the project.

3. Next step is to configure service to use Windows and Sql Role Provider.

Right click web.config from WcfService1 project and select Edit WCF Configuration (if this is not available, Click Tools -> WCF Service Configuration Editor then close it, right click the web.config again the menu should be available)

WCF Configuration Editor Opens.

 

WCF Editor Step 1:  Create Service

In the Services Tab, click Create New Service.  In the service type, click Browse -> bin folder-> Select WcfService1.dll -> then Select WcfService1.Service1 then click Open.

Click Next, Contract should be WcfService1.IService1.

Click Next, for the communication mode select HTTP.

Click Next, for the interoperability select Basic Web Services interoperability.

Click Next, for the address type leave it empty, click Finish. New service was added:

Add BaseAddress, Go to Host -> In Base Address click New:  http://localhost:8000/WcfService1

 

WCF Editor Step 2:  Add Binding Configuration

In the Configuration Tab, go to Bindings -> Click New Binding Configuration, select basicHttpBinding from the list. Set the name to basicHttpBindingConfig.

Go to security tab set the following:

(General) Mode: TransportCredentialOnly

(TransportSecurityProperties) TransportClientCredentialType: Ntlm

Set the existing endPoint (basicHttp) to use the binding configuration that we just created.

To do this: go to Endpoints -> Click the first endPoint then on the general tab -> Endpoint Properties ->

Click Binding Configuration then select basicHttpBindingConfig.

 

 

WCF Editor Step 3:  Configure Service Behaviors

Go to Advance -> Service Behaviors

Modify the existing behavior and rename it to WcfService1.ServiceBehavior.

Click Add and select serviceAuthorization from the list.

Go to general Tab and set the ff:

PrincipalPermissionMode: UseAspNetRoles

RoleProviderName: WcfService1RoleProvider (we would configure this later on).

Update the service to use the service behavior. Go to Services -> WcfService1.Service1 in Behavior configuration select WcfService1.ServiceBehavior.

Click File -> Save.

4. After the WCF editor configuration next step is we need to configure the SQLRoleProvider.

SQLRoleProvider Step 1:  Create SqlRoleProvider database

Open Visual Studio 2010 command prompt and type the following command:

aspnet_reqsql -S {YourDatabaseServer} -E -A r

SQLRoleProvider Step 2:  Update Web.config

Copy and paste the following after configuration tag.

  <connectionStrings>
    <!–Setup Connection String for SQLRoleProvider –>
    <add name=”ASPNetDBConnString” connectionString=”Initial Catalog=aspnetdb;data source={YourDatabaseServer};Integrated Security=SSPI;”/>
  </connectionStrings>

Under system.web add the ff:

  <!–Setup Role Provider to be used for authorizations –>
    <roleManager enabled=”true” defaultProvider=”WcfService1RoleProvider” >
      <providers>
        <clear/>
        <add name=”WcfService1RoleProvider
             connectionStringName=”ASPNetDBConnString”
             applicationName=”WcfService1
             type=”System.Web.Security.SqlRoleProvider” />
      </providers>
    </roleManager>

Click File -> Save.

SQLRoleProvider Step 3:  Assign Roles to windows account

We will create a new role named: PowerUsers and only windows account that has this role will be able to execute the GetData method.

Execute the following script:

USE aspnetdb
GO

— Create a new role
EXEC aspnet_Roles_CreateRole ‘WcfService1’, ‘PowerUsers’

— Assign Windows Account to a Role
EXEC aspnet_UsersInRoles_AddUsersToRoles ‘WcfService1’, ‘{YourDomain\YourUserName}‘, ‘PowerUsers’, 8

5. Last step is to implement the role-based security on GetData method.  Go to WcfService1 project and do the ff:

Add reference to: System.Security

Open Service1.svc code – > Add : using System.Security.Permissions

Update GetData method to:

 

Testing:

For the testing i created a console application that calls the webservice with the following code:

 WcfService1.Service1Client client = new WcfService1.Service1Client();
Console.WriteLine(“Data From server: ” + client.GetData(4));
Console.ReadKey();

 

Sample Output (Calling service with an active directory account that is member of PowerUsers role):

 Sample Output (Calling service with an active directory account that is not a member of PowerUsers role):

 To remove the active directory account from a specific role (PowerUsers), execute the following script:

EXEC [aspnet_UsersInRoles_RemoveUsersFromRoles] ‘WcfService1′,’Domain\ActiveDirectoryAccount’, ‘PowerUsers’

Asp.NET – ReportViewer Control not working on IIS7

We recently upgrade our webserver from II6.0 to IIS 7.5, everything works fine except the ReportingViewer control that renders the MSSQL Reporting in Asp.NET. It shows a blank page with missing icons in IE 6.0 and displays missing resource on FireFox.

To solve the problem, you need to add a new Manager Handler in IIS Manager.

Steps are as follows:

1. Open IIS -> Go to Sites – > {Your WebSite} -> In the IIS section double click Handler Mappings

Handler Mappings in IIS7

2.  On the Action (Right side) click Add Managed Handler and set the ff. properties to:

Request Path: Reserved.ReportViewerWebControl.axd

Type: Microsoft.Reporting.WebForms.HttpHandler

Name: ReportViewerWebControl

Click Ok.

Should be fixed now.

 

 

 

BizTalk WCF Publishing – Configuration Errors

I have installed BizTalk Server 2006 R2 on my Windows XP SP3 machine and trying to make the BizTalk WCF Publishing work. Publishing went fine but when I tried to access the service using the url location (recieve port location) I was plagued with errors.

Error  # 1:

Failed to access IIS metabase.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.Hosting.HostingEnvironmentException: Failed to access IIS metabase.

The process account used to run ASP.NET must have read access to the IIS metabase (e.g. IIS://servername/W3SVC).

 Solution :

1. Go to Event Log  in the Application Logs there should be a warning log about ASP.NET.   Go to process information and get the account name:

Process information:

Process ID: 7472

Process name: aspnet_wp.exe

Account name: {AccountName}           

 2. Open command prompt, then type:

aspnet_regiis -ga {AccountName}

probelem 1 solved.

Error  # 2:

The Messaging Engine failed to register the adapter for “WCF-BasicHttp” for the receive location “/RPaulo/TestService.svc”. Please verify that the receive location exists, and that the isolated adapter runs under an account that has access to the BizTalk databases.

Solution:

Looking at the event log I see that the user account for ASP.NET is trying to connect to BizTalkMgtDb

An attempt to connect to “BizTalkMgmtDb” SQL Server database on server “RPauloBts” failed.

Error: “Login failed for user ‘RPauloBts\ASPNET’.”

Quickest fix is to add the ASPNET account to both BizTalk Application Users and BizTalk Isolated Host Users.

Everything should be ok now.