ASP.NET Web Service Projects in Visual Studio

When you create a managed code XML Web service in Visual Studio, you do so within the context of a Web project. There are several types of Web projects; when you want to work with XML Web services, you will usually use the ASP.NET Web Service project template. For more information on Web project templates, see Introduction to Web Projects. For general information on ASP.NET Web applications, see Introduction to ASP.NET Web Applications in Visual Studio.

After you create an XML Web service project in Visual Studio, you see the Component Designer. The Component Designer is the design surface for your XML Web service. You can use the Designer view to add components to your XML Web service, and the Code view to view and edit the code associated with your XML Web service. For more information, see Code Model for XML Web Services in Managed Code.

Project Files Created by the ASP.NET Web Service Project Template

When you create an ASP.NET Web Service project, Visual Studio constructs a Web application project structure on a development Web server and a Visual Studio solution file on your local computer.

Tip   If you choose to rename the class, be sure to change the class name in the Class attribute of the WebService directive.

Note   To view the contents of the .asmx file, in Solution Explorer, right-click the .asmx file and click Open With on the shortcut menu. In the Open With dialog box, select Source Code (Text) Editor, and then click Open.

For example, if you create a new XML Web service called WebService1 using the ASP.NET Web Service project template, the files that relate to your XML Web service are as follows:

File Created Description
Service1.asmx and Service1.asmx.vb

(or Service1.asmx.cs)1

These two files comprise a single XML Web service. The Service1.asmx file contains the WebService processing directive and serves as the addressable entry point for the XML Web service. The Service1.asmx.vb class file is a hidden, dependent file of Service1.asmx. It contains the code-behind class for the XML Web service. When viewing the Code View of Service1.asmx, you see the contents of this file. For more information, see Code Model for XML Web Services in Managed Code.
AssemblyInfo.vb

(or AssemblyInfo.cs)

A project information file (AssemblyInfo.vb or AssemblyInfo.cs file) that contains metadata about the assemblies in a project, such as name, version, and culture information. For more information, see Assembly Manifest.
Web.config An XML-based file that contains configuration information for ASP.NET resources. For more information, see Application Configuration Files.
Global.asax and Global.asax.vb

(or Global.asax.cs)

A file for handling application-level events. This file resides in the root directory of an ASP.NET application. The Global.asax.vb class file is a hidden, dependent file of Global.asax. It contains the code for handling application events such as the Application_OnError event. For more information, see The Global.asax File.
WebService1.vbproj

(or WebService1.csproj)

The project file for the project, it contains the configuration and build settings and keeps a list of files associated with the project. For more information, see Projects as Containers.
WebService1.vbproj.webinfo

(or WebService1.csproj.webinfo)

Contains the path to the project on the development server.
bin\WebService1.dll The assembly that contains the compiled output of the project. It is first built when creating an XML Web service project and then upon demand. For more information, see Assemblies.
bin\WebService1.pdb This file contains the debug symbols for the XML Web service and enables Edit and Continue debugging of the XML Web service on the server. Visual Studio will only create this file when building a debug configuration of the project. For more information, see Debugging.
WebService1.sln The solution definition file stores the metadata that defines your solution. When the development server is not your local machine, this is the only file that exists locally. For more information, see Solutions as Containers.

1The file extensions, either vb or cs, correspond to Visual Basic or Visual C# XML Web service files, respectively.

Files Deployed with XML Web Services in Managed Code

The server on which you create your XML Web service is typically not the server to which you intend to ultimately deploy the XML Web service. To deploy an XML Web service, you can follow one of two approaches:

  • Build and copy your project to the Web server, or
  • Create a deployment project.

The deployed files that relate to your XML Web service are as follows:

File Created Description
Service1.asmx The Service1.asmx file contains the WebService processing directive and serves as the addressable entry point for the XML Web service. When deployed, the compiled project DLL file, WebService1.dll, contains the code-behind file associated with the .asmx file. For more information, see Code Model for XML Web Services in Managed Code.
bin\WebService1.dll The assembly that contains the compiled output of the project. For more information, see Assemblies.
AssemblyInfo.vb

(or AssemblyInfo.cs)

An optional project information file (AssemblyInfo.vb or AssemblyInfo.cs file) that contains metadata about the assemblies in a project, such as name, version, and culture information. For more information, see Assembly Manifest.
Web.config An XML-based file that contains configuration information for ASP.NET resources. For more information, see Application Configuration Files.
Global.asax An optional file for handling application-level events. This file resides in the root directory of an ASP.NET application. When deployed, the project DLL file, WebService1.dll, contains the code-behind file associated with the .asax file. For more information, see The Global.asax File.
WebService1.disco An optional file that acts as a discovery mechanism for the XML Web service. The .disco file is not automatically created for an XML Web service. For information on creating a discovery file for your XML Web service, see Enabling Discovery for an XML Web Service.

However, the minimum required files to implement an XML Web service are the .asmx file and the DLL.

See Also

Creating XML Web Services in Managed Code | Code Model for Accessing XML Web Services in Managed Code | Deploying XML Web Services in Managed Code | Deploying Applications and Components | Deployment of a Web Setup Project