开发者

Web service bug in .NET

I have the following web service method (.ASMX file):

[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public GetTruckBasicReturnedObject GetPollBasic(ulong truckId)
{
    return new GetTruckBasicReturnedObject();
}

Any time I uncomment this method, when I try to get to the service test page, I get my site's default error page. Just below that I have another service method, with the same attributes that works just fine.

I triple checked to see all my classes are declared, and anyhow I don't get any compilation error.

Class GetTruckBasicReturnedObject has an empty constructor.

We recently migrated from .NET 3.5 to .NET 4.0 but as I said, there is another very simila开发者_StackOverflow中文版r web method, on the same class, that works fine.

The other method that works:

[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public SignInReturnedObject SignIn(string userName, string password)
{
  cLogin login = new cLogin(LocalizationSettings.CurrentDataCenter);
  UInt64 uiUserId;

  //Session is created in the below method!
  RegistrationCodes rc = login.LoginUser(userName, password, (ulong)Channels.TolunaChannel, out uiUserId);
  return new SignInReturnedObject(convertFromRegistrationCodesToRegistrationErrorTypes(rc));
}

The Class:

using System;
using dPolls.Objects;


namespace API
{

public class GetTruckBasicReturnedObject
{

    public TruckBasic truckBasic { get; set; }        //public for debugging reasons

    public ErrorTypes Error { get; set;}            //public for debugging reasons


    public GetTruckBasicReturnedObject()
    {
    }


    public GetTruckBasicReturnedObject(User user, ulong pollId)
    {
        Error = ErrorTypes.None;
        try
        {
            truckBasic = new TruckBasic(user, pollId);
        }
        catch(Exception exception)
        {
            Log.WriteError("Unable to retrieve truck. Exception-{0}",exception);
            Error = ErrorTypes.General;
        }
    }
}

}

What could it be? (Is there any information missing in my question? If so, what is it?)

Thanks a lot.


It seems the problem was the name of the page I requested the web service from. it was "default", which caused ISAPI to kick into very unwanted action. Renaming the page solved the problem.

Thanks again to all replayers.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜