How handling error adapter WCF

I’m working with a custom WCF adapter, and now we get some issue when pipeline failed validation : here is the MSDN explanation to handle it

For a receive location, you can configure one of two error handling options under the Error Handling section on the Messages tab in the Transport Properties dialog box.

If the Suspend request message on failure option is selected, the incoming request message will be suspended should there be a processing failure in the receive pipeline or a failure in the routing of the message. This allows the sender of the message to succeed in their transmission to BizTalk Server and receive an acknowledgment (ACK) message. BizTalk Server will suspend the message and record a complete error record for the failed message. However, it also does not send the message exception back to the sender in this case. This applies to one-way ports only and will send an ACK if checked, and if unchecked will send a NACK. For two-way ports, if processing fails, BizTalk will always receive a NACK.

However, if the client needs to have access to the failed exception, select the Include exception details in faults option. When selected, this returns a SOAP fault to the caller if a processing error occurs. This is the same as specifying the serviceDebug behavior with “IncludeExceptionDetailsInFaults” to True on the Behavior tab of the WCF-Custom or WCF-CustomIsolated adapters. The detailed exception is now sent to the client. This option is more practical and safer to use during development of an application than in production because the internal fault messages most likely should not be sent to callers of the service.

For the two-way send port, you can choose whether to forward SOAP fault messages on to the original caller over a solicit-response send port by selecting Propagate fault message. If this option is not selected, BizTalk Server will generate a NACK first, and then suspend the message. If it is selected, BizTalk Server will treat the message as a valid WCF response message from the external service and the response message will not be suspended because it is propagated.

Publicités

WCF-SQL and XML parameter

WCF-SQL can be used with a Stored Procedure that has an XML parameter.

The Xml parameter is converted in a string parameter in the generated code. So for passing an XML, you need to convert it in string with encoding.

It exists a simpler manner :

  • In your orchestration, only create your XML parameter as a message
  • Send it via your send port to WCF-SQL
  • Now in the send port click on configure
  • Click the Messages tab, and in the Outbound WCF message body section, choose the Template option.
  • In the XML text box, specify the template that will be used to construct the WCF message. By doing so, you create a message that conforms to the operation for the WCF-based SQL adapter
  • For the ADD_LAST_EMP_XML_INFO stored procedure, you must specify the following template:
    <ADD_LAST_EMP_XML_INFO xmlns="http://schemas.microsoft.com/Sql/2008/05/Procedures/dbo">
    <xml_info>
    <bts-msg-body xmlns="http://www.microsoft.com/schemas/bts2007" encoding="string"/> </xml_info>
    </ADD_LAST_EMP_XML_INFO>
  • The Tag encoding is very important. By specifying string, it’ll replace <> and other special caracter by their encoding (like &gt; …)

This method  is very powerfull, the only problem is you need to ensure that your schema is up to date manually

For more information see MSDN : http://msdn.microsoft.com/en-us/library/dd788497(v=bts.10).aspx

Monitoring WCF service with AppFabric

With AppFabric you can monitor your WCF services.

You’ve got two ways for this :

The first one by editing the config file,

Add this section :

 <microsoft.applicationServer> 
    <monitoring> 

      <default enabled="true" connectionStringName="DefaultApplicationServerExtensions" monitoringLevel="Troubleshooting" /> 
    </monitoring> 
</microsoft.applicationServer>

The connectionStringName attribute should contain a reference to an existing connection string in the ConnectionString section, and that’s the database used by AppFabric to store the monitoring events.

The monitoringLevel attribute specifies the number of events you want to capture in a service execution. The possible values for this setting are,

  • Off (monitoringLevel= »Off”): No data is collected. It would be equivalent to have monitoring disabled.
  • Errors only (monitoringLevel= »ErrorsOnly”):  Only errors and warnings events are collected. This is very useful when you don’t want to incur into performance issues for collecting application events but you still want to know about any error may happen during the execution.
  • Health Monitoring (monitoringLevel=HealthMonitoring): This is the default level and collects enough application events to show different metrics in the AppFabric dashboard.
  • End To End Monitoring (monitoringLevel= »EndToEndMonitoring”). It collects all the events from the Health Monitoring level, plus additional events to reconstruct the message flow. For example, Service A called Service B. You will get also events representing info about the Service B call if monitoring is enabled on Service A.
  • Troubleshooting (monitoringLevel= »Troubleshooting »). This is the most verbose of all, so it is appropriate for troubleshooting an unhealthy application.

The second way is more friendly use :

  1. Start or switch to IIS Manager.
  2. In the Connections pane, select the server, site, or application you want to configure.
  3. Right-click the item. On the context menu, click Manage WCF and WF Services, and then click Configure.Alternatively, you can use the Actions pane instead of the context menu. Find the Manage WCF and WF Services section, and then click Configure.
  4. When the Configure WF and WCF dialog box appears, click the Monitoring tab.
  5. View or change settings as necessary. If you change settings, click OK to apply the settings and close the dialog box, or click Apply to apply settings without closing the dialog box. Click Cancel to close the dialog box without saving. (source MSDN

Note : the second modify the config file too

How To disable asp.net development server

People who have large solution with lot of differents projects type (BizTalk, c# WCF….) may want to disable the debugging webserver, when they enter in debug mode.

On the web you can find lot of solution like updating regiter key or delete web debug server.

But the simpliest technic is to disable the project to start the debug asp server :

Click on the project, then go to the property tab and set to false the property « Always Start When debugging » :