How to write an asmx web service without using the app_code directory?

Sorry for the title, but best of all I will just explain the problem.

I have 2 projects in my solution

  • Class library
  • A web application consisting of a web service (asmx).

the web service has a code located in the app_code folder with the [webservicename] .cs file

Inside the webservice code behind the class, I have a web method, here is an example (its simplified):

[WebMethod]
public EnumTaskExportState ProcessTask()
{
    var tm = new UploadTaskManager();
    return tm.ProcessTask();
}

Now during development, in visual studio (2010 or 2008), when I right-click on UploadTaskMananger, and then select "Go to definition". I ended up in AppData \ Temp [some folder structure] ... etc ... and it displays the definition of a public class.

Instead, I would like to have full integration, so that I get directly the actual class in the class library project.

, , app_code, -. .

? , app_code?

+3
2

1... - app_code/.cs. , 4.

2... app_code/.cs,

3. , -, -. Class1.WebServices

4. Class1.WebServices( ), , 1.

5. - -

6. - asmx , ,

<%@ WebService Language="C#"  Class="Class1.WebServices.WebServiceClass" %>

7, !

+2

-, File- > New Web Site. - -.

-, File- > New Project " WCF". , - ASMX ( Microsoft " " ), " - ASP.NET".

- Visual Studio.

, App_Code .

+3

Source: https://habr.com/ru/post/1747966/


All Articles