我尝试将数据发布到远程服务器(Windows Server 2012 R2,IIS 7),并且只有一个类无法正常工作我收到(错误403),但是我的数据存储在我的sqlite文件中。错误403尝试将数据POST到Web服务
我不知道我的这部分代码:
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
};}
当我直接打电话给我的功能AddPatientSession从我的JSON响应,我没有得到错误403 有我在这里的功能在数据库中添加数据:
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);
}
}
此外,当我在本地测试我的代码我的课的工作,所以我检查IIS权限,我没有发现我的问题什么。这真是令人困惑,因为我不知道问题来自我的代码还是来自IIS。
你看到了什么问题吗?谢谢
如果它在本地工作,那么问题将是IIS。如果你查看错误413,你会发现它是一个'Request Entity too Large',这不是ServiceStack错误。这可能意味着您尝试上传超过IIS设置限制的大文件。 [详情请参阅此处](http://blogs.msdn.com/b/jiruss/archive/2007/04/13/http-413-request-entity-too-large-can-t-upload-large- files-using-iis6.aspx) – Scott 2014-08-28 17:43:52
我真的很抱歉@Scott我犯了一个错误,我得到错误“403”。对不起,我什么都很累,当我把我的问题 – Ben 2014-08-29 12:58:31
好吧我修复IIS权限问题,谢谢@Scott,但为什么我有这个问题(错误403)只为这个类。在这个实现中,我得到另一个表的ID来连接我的表和一个连接。我用一个函数来得到它也许它可能是这个?如果我找到答案,我会发布它我很确定它不仅仅是IIS权限 – Ben 2014-09-01 13:33:07