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:
Length cannot be less than zero.
Parameter name: length
Description: An unhandled exception occurred during the execution of the current web request. 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. 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
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
Version Information:
如果您正在使用本地环境托管网站,则Request对象将IpAddress返回“ :: 1 ”作为IpAddress ,其中不包含“ 。 ” 。这可能是造成问题的原因。
It will work if you enter //your ipadress/website name
ie Like 10.11.129.233/HRM after its open from IIS.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.