ASP.NET 4.5 System.OverflowException:算术运算导致溢出

时间:2015-10-25 19:04:34

标签: c# mysql amazon-web-services overflow asp.net-4.5

  • IIS版本6.2(版本9200)
  • 应用程序池.NET 4.5集成
  • AWS Windows Server 2012 R2
  • MySQL社区数据库

我将ASP.NET 4.5应用程序从Windows Server 2008移到了AWS实例Windows Server 2012 R2 Base。我能够得到所有设置,但应用程序现在错误在下面的代码。如果我注释掉下面的代码,那么在从数据库或Int32转换的另一次读取时会发生同样的错误:

lblQuote.Text = "'" + drQuotes["quote"].ToString() + "' (";
  

Stack Trace:OverflowException:算术运算导致   溢出。 System.Data.Odbc.OdbcDataReader.GetSqlType(Int32 i)   +359 System.Data.Odbc.OdbcDataReader.GetValue(Int32 i)+57 path.DisplayQuote()in   C:\的Inetpub \ wwwroot的\ dreamplaybook \ path.aspx.cs:764
  path.Page_Load(Object sender,EventArgs e)in   C:\的Inetpub \ wwwroot的\ dreamplaybook \ path.aspx.cs:180
  System.Web.UI.Control.LoadRecursive()+71
  System.Web.UI.Page.ProcessRequestMain(布尔   includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint)   +3178版本信息:Microsoft .NET Framework版本:4.0.30319; ASP.NET版本:4.0.30319.34248

在AWS Windows 2012中设置我的新MySQL实例后,我通过从以前的MySQL Windows 2008实例运行我的sqldump代码来重新创建数据库。下面是创建表格的示例代码,其中drQuotes将读取访问权限。

--
-- Table structure for table `dpsurvey_quote`
--

DROP TABLE IF EXISTS `dpsurvey_quote`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `dpsurvey_quote` (
  `quoteID` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `qCategoryID` int(10) unsigned NOT NULL,
  `careerID` int(10) unsigned DEFAULT NULL,
  `author` varchar(50) NOT NULL,
  `quote` text NOT NULL,
  PRIMARY KEY (`quoteID`),
  KEY `qCategoryID` (`qCategoryID`),
  KEY `fk_dpsurvey_quote_careerID` (`careerID`),
  CONSTRAINT `dpsurvey_quote_ibfk_1` FOREIGN KEY (`qCategoryID`) REFERENCES `dpsurvey_qcategory` (`qCategoryID`),
  CONSTRAINT `fk_dpsurvey_quote_careerID` FOREIGN KEY (`careerID`) REFERENCES `dpsurvey_career` (`careerID`)
) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

到目前为止,我尝试过的事情还没有成功:

  1. 无法在Visual Studio高级构建配置中找到这些设置,因为它是一个Web应用程序。 a)未经检查的关键字,以便忽略溢出和b)我也无法找到首选32位设置
  2. 我尝试在错误的代码周围使用未经检查的{}块,但没有工作
  3. 在Int32发生错误的地方,我改为Int64但仍然出错了
  4. 非常感谢你的帮助!我已经被困在这几天了。

0 个答案:

没有答案