Solved

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

Posted on 2014-11-05
6
237 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 34

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 34

Expert Comment

by:ste5an
ID: 40428154
Can you post some code? This explanation raises more questions..
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 34

Expert Comment

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

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…

732 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