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 611731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:48:58+00:00 2026-05-13T17:48:58+00:00

I’m creating a DLL with a reference to web services (I don’t have the

  • 0

I’m creating a DLL with a reference to web services (I don’t have the choice to do so) but I have to add web service references to the project that uses the DLL for it to work.

Example, I have the DLL called API.DLL that calls a web service called WebService.svc that I want to use in a project called WinForm. First, I have to add a “Service Reference” to WebService.svc in API.DLL. Then, I add a reference API.DLL to WinForm but it doesn’t work unless I also add a service reference to WebService.svc in WinForm.

What can I do to avoid that last step?

  • 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-13T17:48:58+00:00Added an answer on May 13, 2026 at 5:48 pm

    Your first step is to prove to yourself that this is possible and then adapt your project.

    you can download the runnable solution here.

    I just went through the steps and enumerated my actions to produce the results you desire.

        Create a web app project (an thus a solution) named 'ReferencedWebService'
        Add a web service, just leave the default name and implementation
        Add a class library named 'ReferencedWebserviceAPI'
            Add Service Reference
                >Advanced
                    >Add Web Reference>Web services in this solution
                        >WebService1
                            >Add reference leaving name as 'localhost'
        Add a console application project named 'ReferencedWebserviceClient'    
        To ReferencedWebserviceClient: 
            Add Reference
                >Projects
                    >ReferencedWebserviceAPI
            Add Reference
                >.Net
                    >System.Web.Services
    
        In Program.cs replace Main:
    
        static void Main(string[] args)
        {
            var svc = new ReferencedWebserviceAPI.localhost.WebService1();
            var result = svc.HelloWorld();
            Console.WriteLine(result);
            Console.ReadLine();
        }
    
    
        Set ReferencedWebserviceClient as startup project and run.
    
        Ok, this is simplest scenario. One issue you will have to deal with is that the default Service URL is hardcoded in the .dll,
        and it is set to a ported address on your dev machine.
    
        You will want to add a configuration parameter to your client project. The simplest and most portable way is to use an appSetting.
    
        To ReferencedWebserviceClient:
            Add Item
                >Application Configuration File
    
        Replace contents of App.Config with this, of course replace the value with the appropriate value on your machine.
    
        
        
          
            
          
        
    
    
            Add Reference
                >.Net
                    >System.Configuration
    
        Now replace Main with this:
    
        static void Main(string[] args)
        {
            var svc = new ReferencedWebserviceAPI.localhost.WebService1
                          {
                              Url = ConfigurationManager.AppSettings["serviceUrl"]
                          };
            var result = svc.HelloWorld();
            Console.WriteLine(result);
            Console.ReadLine();
        }
    

    This is the baseline for embedding services in a redistributable .dll.

    Try to apply this model to your current project and see how that works for you.

    If you still have problems, you most definitely have a reference issue and should start looking at it from that perspective.

    Hope this helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 368k
  • Answers 368k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Here's the JavaScript code: Event.observe(window, 'load', function(){ // for all… May 14, 2026 at 5:05 pm
  • Editorial Team
    Editorial Team added an answer Are the images hosted on the same server/website as the… May 14, 2026 at 5:05 pm
  • Editorial Team
    Editorial Team added an answer You can use regex for this. Pattern: (?<protocol>\w+)://(?<ip>[\d\.]+)(:(?<port>\d+)|) May 14, 2026 at 5:05 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.