Why webservices do not allow static methods?
Why something like following is not allowed. I mean why the following method will not be exposed in the web service.
[WebMethod]
public static string Foo()
{
return "bar";
}
It will be great if you can provide me a non language specific high level answer rather than some开发者_如何学Cthing like "Proxy Objects can not call static methods".
The web server could serve requests for your web service with multiple instances simultaneously. These could be split into multiple processes, so any kind of shared state in memory would not be desirable. While this is not a strong argument, it could explain why the designers of the framework did not want to encourage thinking of these methods as static.
精彩评论