System.OverflowException:对于iis 6中的Int16,值太大或太小 [英] System.OverflowException: Value was either too large or too small for an Int16 in iis 6
问题描述
我在visual studio 2012中有一个登录方法。登录的代码是:
i have a login method writen in visual studio 2012. The code of the login is:
public DataSet Login(string UserName, string Password)
{
DataSet Message = new DataSet();
Tbl_Users User = new Tbl_Users();
string ClientIP = Context.Request.ServerVariables["REMOTE_ADDR"];
DataSet result = User.Login(UserName, Password, ClientIP);
if (Int16.Parse(result.Tables[0].Rows[0][0].ToString()) < 0)
{
DataTable dt = Message.Tables.Add("results");
dt.Columns.Add("status");
dt.Columns.Add("results");
DataRow row = dt.NewRow();
row[0] = "-1";
row[1] = ErrorFinder.SQlErrorHandeling(Int32.Parse(result.Tables[0].Rows[0][0].ToString()));
dt.Rows.Add(row);
}
else
Message = result;
return Message;
}
当我在visual studio中执行它时,一切都还可以。但是当我通过visual studio发布网站并将其放入windows seven iis时,我收到了这个错误:
when i execute it in the visual studio, every thing is ok. but when i publish the website by visual studio and put it in the windows seven iis, i got this error:
System.OverflowException: Value was either too large or too small for an Int16.
at System.Int16.Parse(String s, NumberStyles style, NumberFormatInfo info)
at Service.Login(String UserName, String Password)
我不知道发布的网站有什么问题?
i dont know what is wrong with the published website?
推荐答案
我怀疑 result.Tables [0] .Rows [0] [0] .ToString()
包含Int16可以容纳的更大的值。所有类型的整数具有不同的以下存储容量范围
I suspect that result.Tables[0].Rows[0][0].ToString()
contains larger value which a Int16 can holds. All the type of integer has different range of following storage capacity
Int 16 -- (-32768 to +32787)
Int 32 -- (-2,147,483684 to +2,147,483683)
Int 64 -- (-9223372036854775808 to +9223372036854775807)
这篇关于System.OverflowException:对于iis 6中的Int16,值太大或太小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!