简体   繁体   中英

How to invoke or start an asp.net web service (asmx) from another project in C#

How do I invoke or start a asp.net web service (asmx) from another project in C#. The another project can be a console application. I am not asking to consume the web service (which I am doing in Java) but how to start the web service in C# but from a different project.

I already tried including the webservice project in my console application project and also added a reference to the webservice project, included the namespace but I get an error,

The type 'System.Web.Services.WebService' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

I am trying to invoke the webservice by creating an instant of the webservice class which I guess is already a wrong way.

Thanks in advance!

You are going to want to add a web reference.

How to: Add a Reference to a Web Service

Then you are going to want to set multiple projects to start. This will allow you to debug both.

How to: Set Multiple Startup Projects

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM