开发者

NullReferenceException while calling WebMethod

开发者 https://www.devze.com 2023-01-13 07:48 出处:网络
I have the following problem; My console app is running on the server and all I want to do is control it over ASP.NET Web Service.

I have the following problem;

My console app is running on the server and all I want to do is control it over ASP.NET Web Service.

I added new ASP.NET Web Service project to my Solution where my main console app and added reference to it.

The problem is every time WebMethod calls function from console app, i get the nullreferenceexception. Even if I try to use static classes or 开发者_JS百科singletons; every object is null, although my console app is running absolutely correctly.

Should I change some permisions setting or something?

Thank you for your time.


Based on your comments - your console app needs to expose API to administer it. Now this can be possible by using WCF Web Services where your console app needs to host the WCF Services. Controlling console app from ASP.NET web services would be difficult because ASP.NET web services would be hosted in different process/AppDomain (by IIS) - so they somehow need to talk console app process. This across process talk is possible in .NET using remoting or WCF. So its better to use directly WCF to provide web based API (instead of using ASP.NET web services). Refer this article to start with creating simple WCF service and hosting it in console.

0

精彩评论

暂无评论...
验证码 换一张
取 消