Here is a small web service that behaves strangelly:
...
[WebService]
public class ContextInsideConstructor : System.Web.Services.WebService {
public ContextInsideConstructor() {
//CODEGEN: This call is required by the ASP.NET Web Services
Designer
InitializeComponent();
// This throws a Null Reference Exception on mono
string fails1 = Context.Request.PhysicalApplicationPath;
string fails2 = Context.Request.Url.AbsoluteUri;
}
[WebMethod]
public string ReturnPhisicalPath() {
// This works fine
return Context.Request.PhysicalApplicationPath;
}
[WebMethod]
public string ReturnAbsoluteUri() {
// This works fine too
return Context.Request.Url.AbsoluteUri;
}
...
This web service was created with VS.NET 2003 and it works fine on
Windows with the .NET 1.1 from ms. However, mono 1.0 running on linux
gives a NullReferenceException when trying to call either webmethod.
Commenting the lines in the constructor of the WS solves the problem. So
I am guessing the Context object is not properly initialized by the time
mod_mono or xsp hit the constructor.
This is as far as I am willing to go. Hope it helps.
--
Mariano Alarc�n
ContextInsideConstructor.tgz
Description: Binary data