0

I try to post Data to a remote server (Windows Server 2012 R2, IIS 7), and only one of my class is not working I receive (Error 403), but my data are stored on my sqlite file.

I'm not sure about this part of my code:

        public object Post(PatientSessionADD request)
    {
        PatientSessionCRUDFunctions PSCF = new PatientSessionCRUDFunctions(Db);
        PatientDetailsCRUDFunctions PDCF = new PatientDetailsCRUDFunctions(Db);

        // Create the new Session

            // Start Session
            var p = new PatientSession()
            {
                ByPatientId = request.ByPatientId,
                PatientStartSessionTime = request.PatientStartSessionTime,
                PatientStartSessionByUserId = request.PatientStartSessionByUserId
            };

            patientsessionid = PSCF.AddPatientSession(p);

            // --- Generate folder + Images ---
            // Get AgeBlock
            var PatientDetails = PDCF.GetPatientDetailsByID(p.ByPatientId);
            string ageblock = PatientDetails.AgeBlock;
            // Generate path with Session ID
            pdp.GeneratePath(patientsessionid);
            // Call image generator and create images
            TempImageCreationClass.GenerateChartImage(Convert.ToInt32(ageblock));

            // Return a JSON Response
            return new PatientSessionADDResponse 
            {
                PatientSessionId = patientsessionid
            };}

When I call my function AddPatientSession directly from my JSON response, I don't get the error 403. There here my function to ADD Data in the database:

public class PatientSessionCRUDFunctions
{
    // The IDbConnection passed in from the IOC container on the service
    System.Data.IDbConnection _dbConnection;

    // Store the database connection passed in
    public PatientSessionCRUDFunctions(System.Data.IDbConnection dbConnection)
    {
        _dbConnection = dbConnection;
    }

    // Inserts a new row into the PatientSession table
    public int AddPatientSession(PatientSession p)
    {
        return (int)_dbConnection.Insert<PatientSession>(p, selectIdentity: true);
    }
}

Also when I test my code locally my class is working, so I checked IIS Permissions and I didn't found anything for my issue. it's really confusing because I don't know if the problem is from my code or from IIS.

Do you see what problem it could be? Thanks

3
  • 2
    If it's working locally, then the issue is going to be IIS. If you look up error 413 you'll see it's a Request Entity too Large, this isn't a ServiceStack error. It likely means your trying to upload large files that exceed a limit set by IIS. See here for more information
    – Scott
    Aug 28, 2014 at 17:43
  • I'm really sorry @Scott I made a mistake, I get error "403". Sorry about that I what quite tired when I put my question
    – Ben
    Aug 29, 2014 at 12:58
  • Ok I fix the problem with IIS Permissions, Thanks @Scott but why I had this problem (error 403) only for this class. In this implementation I'm getting the ID of a another table to link my tables with a join. I use a function to get it maybe it could be this? If I find the answer I will post it there I'm pretty sure it's not only IIS permissions
    – Ben
    Sep 1, 2014 at 13:33

1 Answer 1

1

I finally found my problem was about IIS authentication, I enable all kind of authentications, it's probably not the best think to do but I don't get this error anymore. enter image description here

1
  • Activate only "Anonymous authentication" and "ASP.NET Impersonation" is enought
    – Ben
    Sep 24, 2014 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.