Wednesday, 1 October 2014

Overriding ConnectionString in Machine.config with web.config ConnectionString.


Overriding ConnectionString in Machine.config with web.config connectionstring.


If I have following connectionstring in my machine.config  (Machine level value)
<connectionStrings>
                 <add name="TestConfigConnection" connectionString="DATA SOURCE=machineCon;PERSIST SECURITY INFO=True;USER ID=usr;PASSWORD=pwd" />
 </connectionStrings>

Now for specific web application I want a different connection string value then we need to override the value in machine.config.
So we  need to add the required connectionstring value in web.config
<connectionStrings>
                 <add name="TestConfigConnection" connectionString="DATA SOURCE=webCon;PERSIST SECURITY INFO=True;USER ID=usr;PASSWORD=pwd" />
 </connectionStrings>


But with this, it will give an error in browser that
Parser Error Message: The entry 'TestConfigConnection' has already been added.

Means when you already have this key connectionstring in machine.config then why are you storing this value again in web.config file.

To overcome this error we need to remove the key in web.config and then need to add it again. So my Web.Config file will have following entry

<connectionStrings>
                 <remove name="TestConfigConnection"/>
<add name="TestConfigConnection" connectionString="DATA SOURCE=webCon;PERSIST SECURITY INFO=True;USER ID=usr;PASSWORD=pwd" />
 </connectionStrings>


This will work J

Sunday, 21 September 2014

Why can't we have send and receive within an atomic scope


Why can't we have send and receive within an atomic scope?


The atomic scope was designed to handle Atomicity, Consistency,
Isolation, and Durability (ACID) compliant operations that must either all succeed or
all fail as a group.

This is a classic database transaction style. It is designed to carry
an orchestration from one stable state to another. This is why you cannot both
send and receive from an atomic scope, because by design the message box is not
a lockable resource
.


To accomplish this atomicity, the orchestration engine persists
the entire orchestration state to the message box before the atomic scope begins; it
subsequently persists the orchestration again when the atomic scope completes.

Wednesday, 5 March 2014

BizTalk : Defining multiple database ReceiveLocation with same db connection string



BizTalk : Defining multiple database ReceiveLocation with same db connection string

BizTalk does not allow us to create the  multiple receive location with Same URI, At design time it validate the URI and if it matches with any receive location then it throw Validation error.
But there may be some requirement where we might need multiple receive location with same URI like multiple database receive location with same database URI and each polling to different set of data (different stored procedure/package.)

So for this requirement, we can implement the multiple receive location with different pollingid. So at design/run time it won’t throw any validation error as the URI is different. The connectionstring with PollingID really doesn’t make any difference and it won’t create any issue while connecting database.

Ex . If I have two receive location polling database

ReceiveLocation1   ->   URI  ->  oracledb://goDEV1/?PolllingID=1111

ReceiveLocation2  ->    URI  ->   oracledb://goDEV1/?PolllingID=2222

ReceiveLocation3  ->    URI ->    oracledb://goDEV1/?PolllingID=3333

BizTalk Oracle/SQL execution error on ReceiveLocation : Action http://Microsoft.LobServices.OracleDB



BizTalk Oracle/SQL execution error on ReceiveLocation


When we try to call SQL/Oracle StoredProcedure/package from the ReceiveLocation with Default PollingAction generated then it might give error as  we need to add “Polling” in the name of package or stored procedure.


The Messaging Engine failed to add a receive location "Zim.EAI.Framework.RL_ReTestGet" with URL "oracledb://goDEV1/?PolllingID=1111" to the adapter "WCF-Custom". Reason: "System.NotSupportedException: Action "http://Microsoft.LobServices.OracleDB/2007/03/EBT/Package/BL_GO_PCK/GETDATA_XML" is invalid.
   at Microsoft.Adapters.OracleDB.OracleDBInboundContract..ctor(OracleDBConnection connection, IOracleCommonUDTHelper oracleUdtHelper, MetadataLookup metadataLookup)




Auto Generated Action :

Correct Action :



Thursday, 20 February 2014

ASP.NET Clear the GridView data on specific condition

ASP.NET Clear the GridView data on specific condition

When there are no data found for user search criteria then we want to clear the previous gridview data and display "No record found" message to user.

This can be achieved by following line of code:
Set the DataSource = null and bind this to your gridview.



if (lblError.Visible == false)
                {
                    if (dvCustomerRecords.Count > 0)
                    {
                        gvCustomer.DataSource = dvCustomerRecords;
                    }
                    else
                    {
                        gvCustomer.DataSource = null;
                        lblError.Visible = true;
                        lblError.Text = "No Record : No record found for specified search criteria!";
                    }
                }

                gvCustomer.DataBind();

Thursday, 13 February 2014

Creating & Configuring Application pool for Website/WCF service in IIS



Creating & Configuring a new Application pool for Website/WCF service in IIS

   1. Create and Deploy your web application/WCf service to IIS.
   2.  Click “Application Pools” à right Click mouse, select “Add Application Pool”

   3. Type the name of Application pool, Select the required framework version and Managed Pipeline Mode.
Click OK. This will create a new application pool.
 


4.For performance and timeout related setting, please go to “Advance Setting” option of Application pool. It’s recommended to update advance setting of application pool carefully. As there are many setting which can affect performance of your application. 



5. Once you create the application pool as per your requirement. Then go to WCF/Web Application which need to be configured to run under this application pool.

6.  Go to “Manage Application” à “Advance setting”


7. Go to “Application Pool”. Click Browse option next to current application pool name. It will open a new popup window. Select the required application pool. For this demo I am selecting the newly created application pool “WCFWebAppPool”.



8. Click “OK”. Now your application will run under newly created application pool.


Wednesday, 12 February 2014

WCF throttling (Resource Utilization/ Load Balance) configuration

WCF throttling (Resource Utilization/ Load Balance) :
Limit how many instances or sessions are created at the application level for better utilization of resource and memory.

Resource Utilization : With the implementation of throttling, we can properly utilize the available resource like Memory, threads. Each resource could be managed at its reasonable limit to avoid very high utilization of any specific resource.

Load Balance :  Application should work under  balanced load. If we execute anything concurrently then there could lot of performance and load balancing related problem will occur.

WCF throttling allow us to manage our resource utilization and balancing the load as per our processor/RAM availability.
We have  following three property which allow us to control WCF service behavior:
      WCF throttling                  -WCF behavior setting  config level
a.       maxConcurrentCalls  - number of messages that currently process across a ServiceHost (Default: (depends on Framework version) * processor count)
b.      maxConcurrentSessions - number of sessions a ServiceHost object can accept, only the channels below the limit are active   (Default: 16 * processor count)
c.       maxConcurrentInstances - number of InstanceContext objects that execute at one time across a ServiceHost (Default: maxConcurrentSessions +  MaxConcurrentCalls)

·    MaxConcurrentSessions (default: 10)
·    MaxConcurrentCalls (default: 16)
·    MaxConcurrentInstances (default: 26)

Default setting for WCF 4.O for scalability according to the Web Server:
MaxConcurrentSessions: default is 100 * ProcessorCount
MaxConcurrentCalls: default is 16 * ProcessorCount
MaxConcurrentInstances: default is the total of the above two, which follows the same pattern as before. (Default: maxConcurrentSessions +  MaxConcurrentCalls)

This setting can be defined at config  file @ service Behaviors level
<serviceBehaviors>
        <behavior  name="Throttled">
          <serviceThrottling
            maxConcurrentCalls="1"
            maxConcurrentSessions="1"
            maxConcurrentInstances="1"
          />
          <serviceMetadata
            httpGetEnabled="true"
            httpGetUrl=""
          />
        </behavior>
      </serviceBehaviors>