Url Behaviour – Asp.NET web service

When adding a webreference to a webservice in visual studio we can set the Url Behaviour property inside visual studio.

In visual studio 2003 by default it is set to static and in visual studio 2005 it is set default to dynamic.

Static means the url is set in the code within the generated proxy class Reference.cs.

Normally this file doesn’t show up in visual studio. Using Show All Files option in visual studio displays this file.

This is what would be there in generated proxy class for Url Behaviour Static

public CrmService() {

this.Url = http://d-3324:5555/mscrmservices/2006/crmservice.asmx”;

And in case of Dynamic we will find a corresponding entry for the url in our application config file.

<applicationSettings>

<WindowsFormsApplication1.Properties.Settings>

<setting name=WindowsFormsApplication1_CrmSdk_CrmService serializeAs=String>

<value>http://d-3324:5555/mscrmservices/2006/crmservice.asmx</value>

</setting>

</WindowsFormsApplication1.Properties.Settings>

</applicationSettings>

And inside our proxy class

public CrmService() {

this.Url = global::WindowsFormsApplication1.Properties.Settings.Default.WindowsFormsApplication1_CrmSdk_CrmService;

Bye


Share your thoughts

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s