我在asp.net c#中使用linq和oracle数据库做了一个应用程序。此应用程序在Widows 7 32位本地主机上正常工作。但是当我在Windows Server 2008 r2中部署此应用程序时给出了以下error.Guide我什么是以下error.How我可以检查部署服务器上这个错误,我怎么能解决这个错误指定的转换无效。错误显示在窗口服务器2008 r2
Specified cast is not valid. 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.InvalidCastException: Specified cast is not valid.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidCastException: Specified cast is not valid.]
System.Data.UnboxT`1.ValueField(Object value) +54
sis.<>c__DisplayClass55.b__0(DataRow r) +38
System.Linq.WhereEnumerableIterator`1.MoveNext() +156
System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +165
System.Linq.d__81`1.MoveNext() +472
System.Linq.Enumerable.Count(IEnumerable`1 source) +267
sis.regreport.Page_Load(Object sender, EventArgs e) +5015
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint) +3178
var vcolM = dt.AsEnumerable()
.Where(r => r.Field<string>("MAJ") == (string)vprglist
&& r.Field<string>("SPEC") == (string)vspecourse
&& r.Field<string>("L_ABR_CODE") == (string)genderEng[1]
&& r.Field<string>("reg") == (string)drRegion["reg"]
&& r.Field<decimal>("year") == syrcnt)
.Sum(r => Convert.ToInt32(r["strength"]));
所有LINQ像以上工作在当地pc.But罚款在windows server 2008中发生错误。在syrcnt是int的情况下。
将断点上线,并准确检查是什么类型的对象键。当你知道这一点时,你将处于一个更好的位置来研究你需要什么类型的演员。 – 2014-08-30 10:40:57
因为在deploymnet服务器中我怎样才能插入中断点 – 2014-08-30 10:43:08
因为在开发服务器上只有DLLs文件可用。但是在本地pc应用程序中工作正常 – 2014-08-30 10:44:34