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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:58:55+00:00 2026-05-24T22:58:55+00:00

I have seen many places in ASP.Net where web services are implemented with an

  • 0

I have seen many places in ASP.Net where web services are implemented with an asmx file. The mark-up is nearly always empty (apart a basic web service tag) and all the code is the “code behind”.

Is this mark-up file legacy from an older way of doing things or does it serve some other purpose?

  • 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-24T22:58:56+00:00Added an answer on May 24, 2026 at 10:58 pm

    Actually, the .asmx file is not a markup file, but a file containing markup. It is perfectly legal to have the full web service implementation inside the .asmx file. To use a code behind file is good practice, but not mandatory.

    Try to build this example in one asmx file, it works:

    <%@ WebService Language="C#" Class="WebService1" %>
    
    using System.Web;
    using System.Web.Services;
    
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    public class WebService1 : WebService
    {
    
        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }
    }
    

    Even in this case you need:

    • The markup to associate service class with the .asmx file
    • The location of the .asmx file within the web application to specify the web service address

    Edit: To be more specific on the last points:

    Every web service needs an endpoint, which is basically an URI to be called by clients. For WCF web services, you usually configure the endpoints in the web.config. The ASP.NET way to define an endpoint is to place the .asmx file somewhere in the web application folder structure. When the webservice is called via this URI the WebService attribute inside the .asmx file tells IIS which class contains the actual web service implementation.

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

Sidebar

Related Questions

I have in many places in my ASP.NET project used the Session variable for
many Places in the sample code i have seen 2 different way of @synthesize
I am new to java, I have seen in the code at many places
I have seen many tutorials on how to compress a single file in c#.
I'm looking to build an ASP.NET MVC application where many screens will have multiple
I have seen many places that IE limits urls to 2000 or so characters
I have seen way to many places where a method takes a long or
I have seen in Java code in many places, people tend to cast between
I've been reading up on file encryption lately, and In many places I've seen
I have seen the clojure symbol -> used in many places, but I am

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.