C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » .NET Framework »

Visual Studio 2005 and Web References


Posted Date: 10 Oct 2006    Resource Type: Articles    Category: .NET Framework
Author: Harish RanganathanMember Level: Gold    
Rating: 1 out of 5Points: 15



Introduction


Visual Studio 2005 no doubt, has been a much better version of the studio, targetting .NET Framework 2.0. This article discusses on the dynamic behaviour of Web References in Visual Studio 2005.

Web Applications and Web Servics


When we develop Web Application and Web Services, we create both the application and web service in our local machine and hence the URL http://localhost/WebService1/Service1.asmx would work very well in our local environment.

What happens when you Deploy


However, when you move your application to Testing or Production machine, the Web Service will reside on a different machine (atleast that is the purpose of using a Web Service, other than platform independence). Hence, you may require to update the Web reference URL in this scenario.

Visual Studio .NET 2003 vs Visual Studio 2005


While in Visual Studio .NET 2003/2002, when you add a Web Reference, a Proxy Class is also added and you can see the code that is generated, in Visual Studio 2005, only the Disco file, Discovery file and WSDL files are added when you add a Web Reference.

The App_WebReferences folder is new in Visual Studio 2005 and whats more new is that the Web Reference URLs are by default dynamic.

In Visual Studio .NET 2003 (and earlier versions), we need to mark the Web Reference URL's URL Behaviour property to dynamic, to ensure that the URL is configurable when you deploy your application. The default property is static. So, if you leave it as such, it may lead to hardcoded Web Reference URL in the proxy classes as well as WSDL.

However, in Visual Studio 2005, the default property is dynamic. The moment you add a web reference to your application, a Key value pair is added under the App Key Settings of your web.config. Needless to mention, the key is nothing but the WebReferenceName.WebServiceName and the value is the URL for the Web Service.

This makes our job simple since after deployment, we just need to change the URL in the Web.Config file and it reflects for all the Web Reference files (disco, discomap and WSDL) created for each Web Reference.

This can be very handy in deployment situations and I really found it worth sharing..

Summary


This article discussed on how, the dynamic behaviour of Web References in Visual Studio 2005 comes handy in deployment scenarios.



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Exploring MySQL 5 with Visual Studio.NET 2003
Previous Resource: Add controls at Run Time Part 1
Return to Discussion Resource Index
Post New Resource
Category: .NET Framework


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use