簡體   English   中英

從Internet信息服務執行期間發生異常

[英]Exception during execution from Internet Information Service

我正在一個網站上工作,從Visual Studio 2008打開該網站時效果很好,但是從IIS(Internet信息服務)打開時,它出現以下錯誤:

長度不能小於零。

參數名稱:長度

說明:執行當前Web請求期間發生未處理的異常。 請查看堆棧跟蹤,以獲取有關錯誤及其在代碼中起源的更多信息。

異常詳細信息:System.ArgumentOutOfRangeException:長度不能小於零。 參數名稱:長度

源錯誤:

Line 174:  StringBuilder sb = new StringBuilder(id, 512);
Line 175:  ////append the first segment of the user's ip address to the string 
Line 176:  sb.Append(ipAddress 
                         .Substring(0, 
                                    ipAddress.IndexOf(".", 
                                                      ipAddress.IndexOf(".") + 1)));
Line 177:  ////append the users User Agent to the string 
Line 178:  sb.Append(userAgent);

源文件:

d:\\ HiFi \\ HRM_Module \\ HRM \\ Global.asax行:176

堆棧跟蹤:

[ArgumentOutOfRangeException:長度不能小於零。參數名稱:長度] System.String.InternalSubStringWithChecks(Int32 startIndex,Int32長度,布爾值fAlwaysCopy)+10090344 ASP.global_asax.CreateMAC(字符串ID,字符串ipAddress,字符串userAgent,字符串validateKey)在d:\\ HiFi \\ HRM_Module \\ HRM \\ Global.asax:77 System.Web.SyncEventExecutionStep.System中的d:\\ HiFi \\ HRM_Module \\ HRM \\ Global.asax:176 ASP.global_asax.Application_BeginRequest(Object sender,EventArgs e)中。 Web.HttpApplication.IExecutionStep.Execute()+80 System.Web.HttpApplication.ExecuteStep(IExecutionStep步驟,布爾值並已完成)+171

版本信息:

  • Microsoft .NET Framework版本:2.0.50727.8009;
  • ASP.NET版本:2.0.50727.8008

如果您正在使用本地環境托管網站,則Request對象將IpAddress返回“ :: 1 ”作為IpAddress ,其中不包含“ 這可能是造成問題的原因。

如果您輸入//您的ipadress /網站名稱 ,它將起作用

即從IIS打開后,就像10.11.129.233/HRM。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM