在调试中运行但不在生产中运行 [英] runs in debug but not in production

查看:68
本文介绍了在调试中运行但不在生产中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的asp.net应用程序,它在调试模式下工作正常,但是当我在生产服务器上运行时崩溃在

以下行:


Dim dt As DataTable


Dim dt As System.Data.DataTable

Dim dt As DataTable = New DataTable


错误消息如下:System.NullReferenceException:Object reference

未设置为实例对象。


这是声明dt的代码中唯一的位置。有趣的是,这将使b / b
在调试和生产中出错。有没有人有任何想法?我好了b $ b。 :)


Scott

I have a simple asp.net app which works fine in debug mode, but crashes on
the following line when I run it on the production server:

Dim dt As DataTable

I have tried the following variations which produce the same result:
Dim dt As System.Data.DataTable
Dim dt As DataTable = New DataTable

The error message reads: System.NullReferenceException: Object reference
not set to an instance of an object.

This is the only place in code that dt is declared. Funny that this will
work in debug and error out in production. Does anyone have any ideas? I
am out. :)

Scott

推荐答案

我认为还有其他事情发生,比如生产服务器

有些文件已经过时了。因此,当它发生崩溃时所显示的行号实际上并不是正在执行的代码。


" Scott" < SC *********** @ nospam.ma-hc.com>在消息中写道

news:e2 ************** @ tk2msftngp13.phx.gbl ...
I would think there is something else going on, like the production server
has some files out of date. So the line number that is shown when it
crashes isn''t actually the code being executed.

"Scott" <sc***********@nospam.ma-hc.com> wrote in message
news:e2**************@tk2msftngp13.phx.gbl...
我有一个简单的asp .net app在调试模式下工作正常,但是当我在生产服务器上运行时,崩溃在以下行:

Dim dt As DataTable

我尝试了以下产生相同结果的变体:
Dim dt As System.Data.DataTable
Dim dt As DataTable = New DataTable

错误信息显示为:System.NullReferenceException :对象引用
未设置为对象的实例。

这是声明dt的代码中唯一的位置。有趣的是,这将在调试和生产错误中起作用。有没有人有任何想法?我好了。 :)

Scott
I have a simple asp.net app which works fine in debug mode, but crashes on
the following line when I run it on the production server:

Dim dt As DataTable

I have tried the following variations which produce the same result:
Dim dt As System.Data.DataTable
Dim dt As DataTable = New DataTable

The error message reads: System.NullReferenceException: Object reference
not set to an instance of an object.

This is the only place in code that dt is declared. Funny that this will
work in debug and error out in production. Does anyone have any ideas? I
am out. :)

Scott



嗨斯科特,


谢谢您使用Microsoft新闻组服务。基于您的

描述,您的某个网页将在生产服务器上运行Null reference

异常,但在调试环境中运行正常吗?另外,

你认为这个问题是由于DataTable引起的。变量。我的

对你的问题的理解是否正确?


如果是这样,我想你可能会首先尝试确认导致的实际对象

例外。由于您在生产服务器上运行异常,您可以

添加一些代码,例如


如果dt是Nothing那么

.....


或其他来确认DataTable变量是否是导致

问题的根源。另外,我认为Marina的建议也很可观,

也许你可以重新启动网络应用程序或网络服务器?或者尝试创建

另一个页面,它具有相同的功能和操作,并且

在调试和生产服务器上运行它以查看是否存在问题

剩余。

如果您需要任何

帮助,请尝试前面的建议并告诉我。

问候,


Steven Cheng

Microsoft在线支持


安全! www.microsoft.com/security

(此帖子按原样提供,不作任何保证,并且不授予

权利。)

Hi Scott,

Thanks you for using Microsoft Newsgroup Service. Based on your
description, one of your web page will running into "Null reference"
exception on production server, however runs ok on debug environment? Also,
you thought the problem is due to a "DataTable" variable. Is my
understanding of your problem correct?

If so, I think you may first try confirming the actual object which caused
the exception. Since you run to the exception on Production server, you may
add some code such as"

If dt is Nothing Then
.....

Or other to confirm whether the DataTable variable is the root caused of
the problem. In addition, I think Marina''s suggestion is also considerable,
maybe you can reboot the web application or the web server? Or try creating
another page which does the has the same functions and operations in it and
run it on both debug and production server to see whether the problem
remain.
Please try out the preceding suggestions and let me know if you need any
help.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


好吧我做了以下:

1)去了微软的网站并对它想要的任何内容做了更新

更新(服务器是Windows 2000 Pro OS)
2)下载最新的.NET框架版本(1.1 Redistributable

Package)并在服务器上运行它。

3)我在VS中打开了解决方案并在其上运行构建,保存文件和

然后将整个目录从我的inetpub / wwwroot目录复制到服务器上的

生产目录(删除所有与项目相关的

服务器上的文件。


我甚至检查了项目的参考资料,以确保我知道他们在哪里

指着。我怀疑这可能是问题所在。我在项目中有2个参考资料

。我把它们作为DLL构建在我的硬盘上。我从主项目中创建了他们的DLL的

引用,我看到VS将它们放入主项目的bin目录中。允许我编写DLL的2个子项目也包含在我的应用程序解决方案中。是否

我还应该指向其他地方?


也许它与此无关。由于我的更改,我在以下代码行中得到了

相同的错误,该代码跟在我之前描述的代码之后

之前:


dt = ds.tables(0)

错误信息(假设它显示的是正确的代码行)似乎

表示它可以'得到一个对象的引用,但ds和dt

变量被正确声明。


请!!!!对此有任何想法将不胜感激!这不应该是在.NET中发生的事情!!!!


Scott


"码头" <所以***** @ nospam.com>在留言中写道

news:OR ************** @ TK2MSFTNGP10.phx.gbl ...
Alright I did the following:
1) Went to Microsoft''s web site and did an update on anything it wanted to
update (the server is a Windows 2000 Pro OS)
2) Downloaded the latest .NET framework version (1.1 Redistributable
Package) and ran it on the server.
3) I opened the solution in VS and ran a build on it, saved the files and
then copied the whole directory from my inetpub/wwwroot directory to the
production directory on the server (after deleting all the files on the
server related to the project).

I even checked the references on the project to make sure I knew where they
were pointing to. I suspect this may be the problem. I have 2 references
in the project. I have them built as DLLs on my hard drive. I created a
reference to their DLLs from the main project and I see that VS dropped them
into the bin directory for the main project. The 2 sub-projects that allow
me to code the DLLs are also included in my solution for my application. Is
there somewhere else I should point them to?

Maybe it has nothing to do with that. Since my changes I am getting the
same error on the following line of code which follows the one I described
previously:

dt = ds.tables(0)

The error message (assuming it is showing me the right line of code) seems
to indicate it can''t get a reference for an object, but the ds and dt
variables are declared properly.

Please!!!! Any thoughts on this would be appreciated! This isn''t supposed
to happen in .NET!!!!

Scott

"Marina" <so*****@nospam.com> wrote in message
news:OR**************@TK2MSFTNGP10.phx.gbl...
我认为有其他东西正在发生,比如生产服务器
有些文件已经过时了。因此,当它崩溃时显示的行号实际上并不是正在执行的代码。

Scott < SC *********** @ nospam.ma-hc.com>在消息中写道
新闻:e2 ************** @ tk2msftngp13.phx.gbl ...
I would think there is something else going on, like the production server
has some files out of date. So the line number that is shown when it
crashes isn''t actually the code being executed.

"Scott" <sc***********@nospam.ma-hc.com> wrote in message
news:e2**************@tk2msftngp13.phx.gbl...
我有一个简单的asp.net应用程序在调试模式下工作正常,但是当我在生产服务器上运行它时,在以下行崩溃


Dim dt As DataTable

我试过以下产生相同结果的变体:
Dim dt As System.Data.DataTable
Dim dt As DataTable = New DataTable

错误消息如下:System.NullReferenceException:Object
引用未设置为对象的实例。

这是声明dt的代码中唯一的位置。有趣的是,这个
将在调试和生产错误中起作用。有没有人有任何想法?
我出去了。 :)

Scott
I have a simple asp.net app which works fine in debug mode, but crashes on the following line when I run it on the production server:

Dim dt As DataTable

I have tried the following variations which produce the same result:
Dim dt As System.Data.DataTable
Dim dt As DataTable = New DataTable

The error message reads: System.NullReferenceException: Object reference not set to an instance of an object.

This is the only place in code that dt is declared. Funny that this will work in debug and error out in production. Does anyone have any ideas? I am out. :)

Scott




这篇关于在调试中运行但不在生产中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆