Solved

Set the web service url dynamically for a class library from windows service application

Posted on 2014-11-05
6
232 Views
Last Modified: 2014-11-15
Hi All, I am having some issue with my web service and need some help.

I have a windows service application and it uses couple of class libraries. One of the class library has a web service and it was configured and I can't change it now. ( As I ma using dll's in my windows application)
Currently this web service is changed.

So, I want to change that class library web service url from my windows service application by using app.config file entry ( this app.config from windows service application).

Is it possible. How can I do that. If so how?

Thanks & Regards
0
Comment
Question by:pothireddysunil
  • 3
  • 3
6 Comments
 
LVL 33

Expert Comment

by:ste5an
ID: 40425726
I solely depends on your library. How does it start the service? How does it bind the service?
0
 
LVL 1

Author Comment

by:pothireddysunil
ID: 40427124
The service is added through the web reference to the class Library and also to my windows service application.

So, it means I have two config files I.e., one for class library and one for my windows service.

I am using my test web service and set it as dynamic in my windows service.  Based on that it has an entry in the app.config file.

I am using class Library dll's in my windows service. When I am running my service, instead of calling test web service, it is calling production service and writing info in production.  Looks like my class library has production web service in it.

So, How can I resolve this issue and how can make my class library use the test web service which is in windows service app.config file.
0
 
LVL 33

Expert Comment

by:ste5an
ID: 40428154
Can you post some code? This explanation raises more questions..
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 1

Accepted Solution

by:
pothireddysunil earned 0 total points
ID: 40433428
Hi All, thanks. I figured it out and here how I resolve the issue.

When ever we use a class library in a windows service or windows application, it always reads the main app.config file to get the config info.
So, I moved all my configuration information from the class library app.config file to the main app.config file ( which is from the windows service or windows application). That resolved my issue.

Thanks,
Sunil P
0
 
LVL 1

Author Closing Comment

by:pothireddysunil
ID: 40444299
Was able to resolve the issue by my self.
0
 
LVL 33

Expert Comment

by:ste5an
ID: 40444648
So your library depends on the default behaviour..
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
These instructions are based on installing Owncloud on your new raspberry pi connected with a usb HDD. What do you need Part A? A Raspberry Pi, model B. A boot SD card for the Raspberry Pi. A usb HDD An Ethernet cable to connect to the lo…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question