简体   繁体   English

从Internet信息服务执行期间发生异常

[英]Exception during execution from Internet Information Service

I am Working on a Website its working well when opened from Visual Studio 2008 but when opened from IIS(Internet Information Service) it gives the following error: 我正在一个网站上工作,从Visual Studio 2008打开该网站时效果很好,但是从IIS(Internet信息服务)打开时,它出现以下错误:

Length cannot be less than zero. 长度不能小于零。

Parameter name: length 参数名称:长度

Description: An unhandled exception occurred during the execution of the current web request. 说明:执行当前Web请求期间发生未处理的异常。 Please review the stack trace for more information about the error and where it originated in the code. 请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息。

Exception Details: System.ArgumentOutOfRangeException: Length cannot be less than zero. 异常详细信息:System.ArgumentOutOfRangeException:长度不能小于零。 Parameter name: length 参数名称:长度

Source Error: 源错误:

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);

Source File: 源文件:

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

Stack Trace: 堆栈跟踪:

[ArgumentOutOfRangeException: Length cannot be less than zero.Parameter name: length] System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) +10090344 ASP.global_asax.CreateMAC(String id, String ipAddress, String userAgent, String validationKey) in d:\\HiFi\\HRM_Module\\HRM\\Global.asax:176 ASP.global_asax.Application_BeginRequest(Object sender, EventArgs e) in d:\\HiFi\\HRM_Module\\HRM\\Global.asax:77 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171 [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

Version Information: 版本信息:

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

如果您正在使用本地环境托管网站,则Request对象将IpAddress返回“ :: 1 ”作为IpAddress ,其中不包含“ 这可能是造成问题的原因。

It will work if you enter //your ipadress/website name 如果您输入//您的ipadress /网站名称 ,它将起作用

ie Like 10.11.129.233/HRM after its open from IIS. 即从IIS打开后,就像10.11.129.233/HRM。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM