Generic Handler - Parser Error, Could not create type

Asked

Viewed 81 times

1

Next guys, I made a simple Generic Handler, just to give me back one person, just for the record, the code is this way

    public void ProcessRequest(HttpContext context)
    {
        context.Response.Cache.SetNoStore(); 
        context.Response.TrySkipIisCustomErrors = true;
        context.Response.ContentType = "application/json";
        context.Response.ContentEncoding = Encoding.UTF8;

        Pessoa p;
        p = new Pessoa();
        p.Nome = "Enzo";
        p.SobreNome = "Tiezzi";
        p.Idade = 19;
        //"{"Nome":"Enzo","SobreNome":"Tiezzi","Idade":19}"
        String json = new JavaScriptSerializer().Serialize(p);
        context.Response.Write(json);
        context.Response.StatusCode = 200;
    }

On my local server (IIS) it works normally, but when I put it on an online server it brings me the following error when accessing the .ashx directly:
Parser Error

  • Dude, I’ve had enough problems with Publish from Visual Studio. I published my project and when I played on IIS it didn’t work and on my IIS Express (Visual Studio) it worked. I started doing research and realized that Publish did not contemplate all the necessary files, especially with Report Service and others. I’m not saying that’s it, but it’s always nice to check and see if all the necessary files are on your server.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.