Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 295445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:27:32+00:00 2026-05-12T06:27:32+00:00

I have the same ASP.NET WebService deployed 3 times under 3 different URI’s configured

  • 0

I have the same ASP.NET WebService deployed 3 times under 3 different URI’s configured to look at 3 different databases environments.

I have a Class Library that uses the WebService using a Web Reference.

Every time I want to compile the Class Library to a different environment I have to change the Web Reference by hand to the appropriate URL.

Although not complicated this is a pain for creating Live versions of the Class Library and slows down our deployment process (A quick note there are multiple .asmx files but this example describes only 1 so that it is easier to understand).

What I am trying to do is have a DataServices class that returns an Interface for the WebService. In the Class Library all 3 Web References exist and I instantiate the correct one via simple configuration in the Class Library itself then return the right Web Service as an Interface.

This all seems straightforward to me but it isn’t working as the Interface doesn’t appear to work though Web Services. Can someone please confirm this for me or tell me what I’m doing wrong?

Unable to cast object of type ‘Company.Project.Classes.MyWebServiceLive.MyWebService’ to type ‘Company.Project.Interfaces.IMyWebService’.

Thanks

EDIT
The WebService is of course implementing the Interface, which is all I thought I’d need to do…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T06:27:33+00:00Added an answer on May 12, 2026 at 6:27 am

    You do not need to change the web reference and recompile. Simply set the Url property of the web service proxy to point at the correct service:

    using (var svc = new MyWebServiceReference.MyService()) {
        svc.Url = theUrlToUse;
        return svc.SomeMethod();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have deployed ASP.NET web site and ASP.NET web service on the same web
I have a situation where I have several listbox controls on the same asp.net
I have two ASP.NET sites (they can not run in the same process) and
I have an asp.net mvc 2 app. I need to display the same page
I'm using ASP.NET on C# and I have a referanced library in the same
I have two .ascx files in the same folder in an ASP.NET MVC project.
I have an asp.net application and webservices (asmx) that reside in the same application
I have a WCF webservice that acts as a data provider for my ASP.NET
I have an asp.net mvc application, phpBB forum and asp.net webservice that I want
I have an ASP .net application that calls a webservice. The webservice calls the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.