Monday, July 4, 2011

FTP adapter issue: Unable to receive the file ""


Moving the original post
I was working on a client application where I need to receive files from FTP server. The following are main points of this application
·                  Based on the history I figured out the maximum size of file could up to 5KB (not to big).
·                  A single host instance was created for the host specified as receive handler for FTP adapter.

Problem:
Duplicate files were getting received with the following messages in event log.

Event Type:     Warning
Description:
The adapter "FTP" raised an error message. Details "Unable to receive the file "<FileName>" from the FTP server.  The error that occurred was "A stream read or write operation failed because the stream is in an error state. ". ".

Event Type:     Error
Description:
There was a failure executing the receive pipeline: "Microsoft.BizTalk.DefaultPipelines.PassThruReceive, Microsoft.BizTalk.DefaultPipelines, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Source: "Pipeline " Receive Port: "<ReceivePortName>" URI: "<URI>" Reason: Unable to receive the file "<FileName>" from the FTP server.  The error that occurred was "A stream read or write operation failed because the stream is in an error state. ".

FTP modes
You can use FTP in one of two ways: passive or active.
In active mode FTP client connect to a remote FTP server and requests information or a file, the FTP server makes a new connection back to the client to transfer the requested data. The FTP client chooses a random port to receive the data connection on. The client sends the port number it chose to the FTP server and then listens for an incoming connection on that port. The FTP server then initiates a connection to the client's address at the chosen port and transfers the data.
In passive mode the FTP client requests that the server pick a random port to listen on for the data connection. The server informs the client of the port it has chosen, and the client connects to this port to transfer the data.
Cause
I noticed that this error is occurring only when the number of files are more than 120 i.e. when the connection need to be opened for some long time. After going through the FTP log it seems as connection was getting terminated before all the files get transferred.

After confirming from the networking team I came to know that the firewall block the incoming connection.
Resolution
After changing the Mode to ‘Passive’ in the FTP adapter the issue gets resolved.

Cheers
Rohit Sharma

Error: “The document specification ‘...’ from assembly ‘...’ failed to load.”

Moving the original post
In BizTalk server 2010 I published an orchestration as WCF service using the ‘BizTalk WCF Service Publishing Wizard’. The orchestration gets published successfully. After configuring and starting the orchestration when trying to consume the WCF service, I was getting following errors:
In the client code consuming the WCF service exception was
The server was unable to process the request due to an internal error.  …
In the event log on the BizTalk machine:

Error:

There was a failure executing the receive pipeline: "Microsoft.BizTalk.DefaultPipelines.XMLReceive, Microsoft.BizTalk.DefaultPipelines, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Source: "XML disassembler" Receive Port:
…
The document specification ‘..’  from assembly ‘..’ failed to load. Verify the schema for this document specification is deployed and is in the Global Assembly Cache.

Warning:

The adapter "WCF-WSHttp" raised an error message. Details "System.TimeoutException: The service's security session did not receive a 'close' message from the client within the configured timeout (00:00:10)….
I verified that the assembly containing schema was deployed to GAC and I was facing the same issue after increasing the timeout value for Open,Send and Close for WS-Http receive location.

Solution

Based on the error received in the client code I tried to investigate the WCF service deployment in IIS 7. The actual problem was the application pool used for WCF service was using .Net Framework v2.0.50727 after changing it to v4.0.30319 the issue got resolved. This issue occur because the path of GAC has been changed in the .Net Framework 4.0.

Cheers
Rohit Sharma

Error: “Root element is missing”


Moving the original post

In BizTalk 2010 I created a WCF-WSHttp receive location. Then using the BizTalk WCF Service Publishing Wizard I created a meta data only endpoint, based on my WCF-WSHttp receive location and I added the required schema. The WCF service was created successfully. The application Pool used for this WCF service was configured using the identity having access to BizTalk databases.
When I tried to see the WSDL I got the exception: “Root element is missing”.

To resolve this issue I have to do the following two extra steps:

1.  Added the account used to configure the application pool to BizTalk Server Administrators group.

2. Added the following line to the Web.Config of WCF services created with the BizTalk WCF Service Publishing Wizard.
<system.web>
          <trust level="Full" originUrl="" />
<system.web>
For additional information refer to this MSDN link.

Cheers
Rohit Sharma

Storing File location in Tracking profile editor's DocumentReferenceURL


Charan: I have a simple scenario where the message flows in through a receive port and is subscribed by a FILE send port for storing at the backup location. I want to store the path of the message in BAM activity.

Rohit: You can use the Document Refernce URL to do it. Let me show how.
Open your deployed activity in TPE and add New Document Reference URL as shown below:
 
Rename the document reference URL to something appropriate e.g. DocumentPath

Associate the data with this DocumentPath

Set Port mapping to the FILE Send Port. Do the same for other milestone in the BAM activity and deploy the tracking profile.

You will found the path of document in the Related Document Section in Activity Status as shown below:





Cheers,
Rohit Sharma

Thursday, June 30, 2011