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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:12:24+00:00 2026-06-14T11:12:24+00:00

In a basic .NET web service (asmx) which I am building locally, I’m trying

  • 0

In a basic .NET web service (asmx) which I am building locally, I’m trying to log using Log4NET to a file. This works fine if I fire up debugging mode in Visual Studio and test the service using the wsdl/test pages provided. But if I try using a separate client (I made a C# console app to call the service), I see the expected response, but get NO logging.
(The separate client code is listed below. I had to import a reference to the built DLL of the web service.)

I’m a bit new to this, but I speculate the issue is because outside of the VS server or IIS (which I am stuck without), Global.asax is not used (which contains my initialization command for logging). But I need to test from an external client. How can I get Global.asax to initialize from the client application perspective, or how can I avoid needing to? Does this sound like it would solve my logging issue?

Global.asax in my web service project contains this statement:

protected void Application_Start(object sender, EventArgs e)
{
    log4net.Config.XmlConfigurator.Configure();
}

And my separate client (console) application looks like this:

static void Main(string[] args)
{
    MyWebService proxy = new MyWebService();

    MyWebService.Request request = new MyWebService.Request();
    request.Type = "Test";

    MyWebService.Response response = proxy.GetResponse(request);

    Console.WriteLine("RESPONSE CODE: " + response.StatusCode);
    Console.WriteLine("RESPONSE MSG: " + response.StatusMessage);
    Console.WriteLine("Press any key to continue...");
    Console.ReadKey(true);
}

I’m also unclear how I would change this console app to reference the Visual Studio server instance (ex: localhost:1583/MyWebService.asmx?op=GetResponse) instead of creating a proxy instance of the web service. I think that would also do the trick, since the Visual Studio server utilizes Global.asax, no?

  • 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-06-14T11:12:25+00:00Added an answer on June 14, 2026 at 11:12 am

    The simpler way

    would be to move the log4net initialization inside static void Main:

    static void Main(string[] args)
    {
        log4net.Config.XmlConfigurator.Configure();
    }
    

    Don’t forget to include log4net configuration in app.config file of your new host.

    The better way

    would be to move your service to separate project (it is already so, right?) so it is complied into it’s own assembly. Than apply

    [assembly: log4net.Config.XmlConfigurator(Watch=true)]
    

    attribute to the assemlyInfo.cs. Refer to log4net configuration manual for details (search for word assembly on the page). This way is better, because you’ll not have to add that

    log4net.Config.XmlConfigurator.Configure(); 
    

    into the initialization of all host environments you have.

    But make sure you have your log4net configuration in app.config, web.config or whatever configuration file you have.

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

Sidebar

Related Questions

Trying to do basic SSL-authenticated Web Service using Visual Studio 2008 .NET 3.5 Service
I have wrote a basic web service using .net which I intend to use
I'm creating a basic web service in asp.net/c# using simple ASMX services. When I
Goal: Provide a web service using Visual Basic or C# or .NET that interacts
Using Basic Authentication, and the asp.net Web-Api, where JSON Get/Post's to my API, I
I have a website that uses basic ASP.Net forms authentication. In the web.config file
I'm trying to write a web service client in c# which the webservice is
I have a problem with some basic ajax and asp.net web service. In my
We are building a web service with WCF on .net 4.0. The service will
I have a messaging system that is a .NET 2 ASMX web service, very

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.