Web Site Project: How to configure web service URL in web.config (web service defined in a referenced DLL)

I have a web site that references a business logic DLL project. In the business logic project, there is a web service defined in its app.config file something like this:

<applicationSettings>
  <
MyNamespace.BLL.Properties.Settings>
    <
setting name="MyNamespace_BLL_MyServer_ServiceName" serializeAs="String">
    <
value>http://blah.blah.blah.asmx</value>
  </
setting>
  </
MyNamespace.BLL.Properties.Settings>
</
applicationSettings>

When the web site is published, the web service is still available from the web site code because - despite the fact there is no app.config file in the published web site - default values are hard-coded into the business logic DLL automatically by Visual Studio.

However, I would like to be able to override the web service URL in my web.config file.

Is this possible? I tried adding a key to <appSettings> in web.config, but it didn't appear to pick that up.

0
mbell
5/29/2008 4:04:14 PM
asp.net.config-deploy 12495 articles. 0 followers. Follow

3 Replies
3093 Views

Similar Articles

[PageSpeed] 46

You can override the URL of the web reference by modifying the .url property.

For example,

Dim wrSomeWebservice as new webService1()

wrSomeWebservice.url ="http://blah.blah.blah.asmx"


Bruce
DiscountASP.NET: Developer Ready ASP.NET Web Hosting
- Microsoft Gold Certified Partner
- Voted 2008, 2007, 2006 & 2005 Best ASP.NET Web Hosting by asp.netPRO Magazine
0
Bruce
5/29/2008 7:03:49 PM

Bruce,

The web service is encapsulated within the business logic. Although it would be possible to include a public static method to update the internal web service URL this seems an odd approach to take. Far simpler would be the ability to set the information in web.config. You can do it in a forms app so why not in a web site?

0
mbell
5/30/2008 8:19:17 AM

mbell:

Bruce,

The web service is encapsulated within the business logic. Although it would be possible to include a public static method to update the internal web service URL this seems an odd approach to take. Far simpler would be the ability to set the information in web.config. You can do it in a forms app so why not in a web site?

mbell,

what you are saying is right. We should have these settings in a configurable file.

See this link :- http://blogs.msdn.com/nickmalik/archive/2004/11/25/270420.aspx

this will resolve your concerns.

Kindly mark as answer if helps. Revert if any queries.


J. Venkatesh
Syntel
0
venkyzeal
5/30/2008 2:36:05 PM
Reply:

Similar Artilces:

Changing URL in web.config for web service
I added a web reference to asmx file. In web.config - it adds - undefinedadd key="CoreService.CoreServices" value="http://test/CoreServices.asmx I then change it to <add key="CoreService.CoreServices" value="http://test2/CoreServices.asmx"/> But CoreService.CoreServices still looks for http://test/CoreServices.asmx.  What else do i have to change? I think CoreService.CoreServices are hard coded into the source code.  Girijeshhttp://www.girijesh.in/ I think CoreService.CoreServices are hard coded into the source code.  Girijeshhttp://www.girijesh.in/ So no ...

Web Service NameSpace URL Configurable in Web.Config
I am trying to allow the Web Service URL to be set via the Web.Config file.  I have read that Service.URL can change where the URL documented NameSpace can be configured.  However, from what I can tell, it seems that it is mostly called from the WebServices Client after creating an instance of the Web Service and then calling Service.URL from the client to change the URL upon consuming the Web Service.  Is there anyway to configure this in the Web Service on the server side?  And if so, where does Service.URL go and how do I setup the Web Service Namespace's in the ac...

How do I merge web services' app.config with web app's web.config? Help!!
I have a web application project that uses a separate class library containing web service references (service layer). I want to be able to configure the web reference URLs dynamically and I know you can set this up by setting the URL behavior to  'Dynamic', etc, etc. The problem is VS2005 puts the URLs in the project's app.config file. When the class library becomes a DLL component, I have no way of accessing the app.config file.Is there a way to make the web reference project to look for the URLs in the web.config instead of its app.config? Or is there a way to merge this app.config w...

Can "Add Web Reference" if web service deployed to new web site, Can't add ref if deployed to Virt Server under Default web site (Sharepoint)
I have created a web service wich I can deploy successfully to a new IIS Web, but of course I have to set the port to something other than 80 (and I'd rather just use a virtual server under the Default web). If I try to deploy my web service under the Default Web as a new virtual server, and then try to "Add a web Reference" to the service, it fails with a 404: not found error. Notes: WServer 2003 My IIS server is running Sharepoint Portal Server (SPPS)sp2.  VS2005 Any ideas? /Bob C in GRR In Sharepoint Portal Admin I had to add a Path Exclusion.  Took me a whi...

Web Services and Web.config
Can the functions within my asmx file access the values in my web.config file. I'm trying to access a value using the following code: ConfigurationSettings.AppSettings("MyValue") The error that i'm receiving is saying that ConfigurationSettings is not declared. how can i reference the web.config values? Do you imported System.Configuration namespace! Inorder to use ConfigurationSettings you have to import that name space! Hope it helps!Sreedharhttp://www.w3coder.orgweblog http://weblogs.asp.net/skoganti Thanks for the reply. I didn't have system.Configuration imp...

web web web
Name: bahadir Email: sensiz_olmuyor_t1_at_hotmail.com Product: Firefox 2 Beta 2 Summary: web web web Comments: web sayfası yapmak Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; tr; rv:1.8.1b2) Gecko/20060821 Firefox/2.0b2 ...

Web.Config error when deploying a web service
I have been building a simple distributed app with a web service and have had it working perfectly on my test setup (My WinXP Pro as the client, SmallBusinessServer 2k3 / IIS 6 / .Net Framework 1.1). When deploying the web service to our production server (Small Business Server again, identical setup, I believe) using VS.net 2003 and a simple copy project deployment I receive the following error. Can anyone help ? Error code as follows: Server Error in '/DimEX' Application. -------------------------------------------------------------------------------- Configuration Error ...

Deploy VS 2003 Web Site with web services Web Refrences
I have developed a web site that communicate with web services in another server, but when i was running it locally on my development machine it was working fine, but now when i have deployed on the server, i have changed the URL on the web refrences folder to point to the web services server. But it keeps giving me Page Not Found 404 error. As it couldnt find the web services, even though when i put the same URL in browser it gets the services okay?  When deploy web services, is there any other task that i should do rather than chaging the URL of web refrences in the .disco, .wsd...

Web Deployment Projects: Web.config sections <system.web>
I like "Web Deployment Projects" a lot - WELL done!I encounter the following by trying to replace the system.web config section in Web.config.During the build I get   Web.config (1): error WDP00002: missing section system.web.I can replace other parts of the Web.config, like appSettings, connectionStrings and even system.runtime.remoting, but not system.web.Any ideas? Thankx! I think you have the honors of finding the first bug.  We're using Configuration.Sections[] to acess the replaceable sections and it doesn't appear to work with system.web.I'll enter the bug. ...

Ajax call web services failed after convert web site into web project
Hi Guys I have one web site application and use ajax call web services. it is working very well. 1. Master page set up scriptmanager with webservices path. 2. Web service inside web site application under app_code named ajaxwebservice.cs 3. Javascript call ret=ajaxwebservice.method(id, oncomplete(),ontimeout(),onerror()); But after I convert web site into web application project, the ret=ajaxwebservice.method(id, oncomplete(),ontimeout(),onerror()); failed, the ajaxwebservice in undifined error. I use the same web.config, master page, I put my ajaxwebservice.asmx and ajaxwebservic...

configure web service url while installing web site
Hi,I'm trying to build a web setup project that installs a web site with a custom action.The web site that is being installed,consumes a web services - which url is specified during the installing process.The custom action should place the entered url into the web site web.config file.I'm following this tutorial here:http://weblogs.asp.net/scottgu/archive/2007/06/15/tip-trick-creating-packaged-asp-net-setup-programs-with-vs-2005.aspxA little bit updated to updated the AppSettings instead of the ConnectionStrings section.However, at this code i age an exception:void ConfigureData...

web.config file error when referencing web service
Hello, I am trying to add a web service to my app which is on a remote server where I work. When I try to add it I get the following error:  Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.confi...

Ajax error calling Web Service from Web Application Project vs Web Site
I am implementing the code from the Asp.Net Ajax Video Demo “How Do I: Make Client-Side Network Callbacks with ASP.NET AJAX?”  The Web page is generating a javascript error (‘SimpleService’ is undefined) and is unable to recognize the Web service.  The downloaded examples work, however I have created the Demo (both the page and the web service) in a Web Application Project, rather than a Web Site.  The demo uses a Web site.  Because of this the page does not recognize the Web service. To ask the question another way: What needs to be done differently in a Web Service...

Web Deployment Project - Config Properties
I'm using a Web Deployment Project to compile my web site. In the Property Pages - Configuration Properties - Deployment section, there is an option to 'Enable Web.config file section replacement'. I have this working to replace certain sections of my web.config for each build config (release/staging/dev). I think this makes sense so other developers do not have to remember to change the web.config file. HOWEVER, this only seems to work when replacing parts of web.config; such as appSettings, connectionString, etc. This would require me to have separate config files for each section and bui...

Web resources about - Web Site Project: How to configure web service URL in web.config (web service defined in a referenced DLL) - asp.net.config-deploy

Criterion-Referenced Competency Tests - Wikipedia, the free encyclopedia
The Criterion-Referenced Competency Tests (CRCT) are a set of tests administered at public schools in the state of Georgia that are designed ...

SmartPlates & Charts - Geo-referenced VFR & IFR Maps and Procedures on the App Store on iTunes
Get SmartPlates & Charts - Geo-referenced VFR & IFR Maps and Procedures on the App Store. See screenshots and ratings, and read customer reviews. ...

Gay rights referenced in new citizenship guide
A revised citizenship study guide for new Canadians released Monday contains a single sentence on gay and lesbian rights, which is a sentence ...

Google Glass bone conduction technology referenced in FCC filing
As if Google Glass wasn't already cool enough, today we're finding out that it feature bone conduction technology. The glasses recently made ...

Retina-Equipped iMac Referenced In OS X 10.10 Yosemite
... to receive an ultra-high resolution display. According to MacBidouille ( via MacRumors ), a Retina display-equipped iMac is indeed referenced ...

Facebook profiles: now cross-referenced with retail purchases!
CVS is one of the companies that manages its loyalty program data with Facebook's new partner, Datalogix. Elvert Barnes Facebook is now using ...

CBS News releases video referenced in O'Reilly dispute
NEW YORK (AP) — CBS News on Monday released video from four stories it aired about the Falklands War in 1982, all part of a dispute involving ...


"I don't think anything can prepare you to hear your own name referenced by a Supreme Court justice as ...
"If I remember correctly, 'Gratz' was referenced in the very first question asked that day. Each time they mentioned my name, I wanted to jump ...

Can You Name All 85 Best Picture Winners Referenced In This Wonderful Oscars Ad?
Designer Olly Moss said this poster for the Oscars was the hardest he's ever had to create. The brief: reference every single Best Picture winner ...

Resources last updated: 11/21/2015 11:50:40 PM