서버에서 웹 프로젝트를 업로드했습니다.ASPX는 로컬에서는 작동하지만 서버에서는 작동하지 않습니다.
개발이 진행된 내 로컬 PC에서 원활하게 실행되는 동안 서버에서 전혀 실행되지 않습니다. 지금까지 내가 읽을 수있는 오류, theres '빈 데이터 집합 (SQL 데이터베이스에서 데이터를 가져옵니다) 문제. 다시 aspx를 로컬에서 실행할 때 모든 것이 정상입니다. 오류 로그에서 볼 수있는 또 다른 문제는 로컬 드라이브 "D : ..."를 가리키고 있다는 것입니다. 서버 주소를 가리켜 야합니까?
오류.
There is no row at position 0.
Exception Details: System.IndexOutOfRangeException: There is no row at position 0.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[IndexOutOfRangeException: There is no row at position 0.]
System.Data.RBTree`1.GetNodeByIndex(Int32 userIndex) +2474798
System.Data.DataRowCollection.get_Item(Int32 index) +21
WEB.Default.Page_Load(Object sender, EventArgs e) in D:\dev\Visual Studio\Temp\WEB\Default.aspx.cs:59
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3064
어떤 아이디어가 있습니까? VS2010에서 게시 도구를 사용하고 성공적으로 서버에 업로드합니다. 하지만 작동하지 않습니다.
페이지로드에 try/catch가있는 경우 웹 페이지가이 오류를 보내는 이유가 아닙니다. 오류가 있으면 레이블을 친숙한 메시지로 설정합니다.
감사합니다.
편집
다음 페이지로드 코드입니다.
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (!IsPostBack)
{
Session["FlagOpen"] = false;
var windowsIdentity = WindowsIdentity.GetCurrent();
if (windowsIdentity != null)
{
var userName = windowsIdentity.Name;
userName = Regex.Replace(userName, ".*\\\\(.*)", "$1", RegexOptions.None);
var ds = _objUser.GetRanking(userName);
var ranking = ds.Tables[0].Rows[0][1].ToString();
_objPersona.Ranking = ranking;
_objPersona.UserName = userName;
_objPersona.RealName = ds.Tables[0].Rows[0][0].ToString();
Session["User"] = _objPersona;
LblUserName.Text = ds.Tables[0].Rows[0][0].ToString();
ds = _objUser.GetFAQ(userName);
var cant = ds.Tables[0].Rows.Count;
}
else
{
BtnAbrirBandeja.Enabled = false;
LblUserName.Text = "Not allowed.";
}
}
}
catch (Exception)
{
LblWarnings.Text = "Error. Please contact sysadmin.";
throw;
}
}
편집 2.
페이지는 로컬 작업을 유지합니다. 하지만 서버에는 없습니다. 로컬 폴더를 가리키는 원래 오류가 발생합니다 (이미 업로드되어 서버에서 실행 중일 때). null 인 DataSet은 웹이 SQL 서버와 통신 할 수 없기 때문에 발생합니다. 따라서 오류. 기본적으로 디버깅 중에는 정상적으로 실행되지만 서버에서는 실행되지 않습니다.
아이디어가 있으십니까? 감사. 어떤 이유를 들어
합니다. – PhonicUK
바보 같은 질문이지만 서버에서 액세스 할 수있는 데이터베이스입니까? – Jay
@PhonicUK 필요한 경우 Page_Load를 보여줄 수는 있지만 (로컬로) 작동하기 때문에 로컬/서버 aspx 항목에서보다 일반적인 오류가 발생한다고 가정합니다. –