tags:

views:

27

answers:

1

I am working with .NET solution project and there are a couple projects in side of the solution. One of projects has asmx file. Now, my question is that is it possible to call web methods in the asmx file directly from other projects in same solution instead of adding web reference of it?

Thanks.

+1  A: 

ASMX files are usually placed in ASP.NET projects which are not suitable to be referenced by other projects. For this reason I would recommend you refactoring the functionality into a class library that will be referenced from the web service and from other projects where you directly call the methods:

var result = new SomeClass().SomeMethod();

and in the web service:

[WebMethod]
public string SomeMethod()
{
    return new SomeClass().SomeMethod();
}
Darin Dimitrov