发布asp.net网站给予"未将对象引用设置到对象的实例"错误 [英] publishing asp.net website give "Object reference not set to an instance of an object." error

查看:1110
本文介绍了发布asp.net网站给予"未将对象引用设置到对象的实例"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我厌烦了这个错误。我寻遍了网络,并试图每一个可能的建议,这个错误我能找到。


  1. 删除APP_ code,构建添加文件回来,发布。 (没有工作)

  2. 删除临时文件asp.net(没有工作)

在最后,我甚至尝试在命令行中,并得到以下堆栈跟踪。

 错误ASPRUNTIME:对象引用不设置到对象的实例。[的NullReferenceException]:对象引用不设置到对象的实例。
   在System.Web.Compilation.BuildManager.Copy precompiledFile(VirtualFile vfile,
 串destPhysicalPath)
   在System.Web.Compilation.BuildManager.CopyStaticFilesRecursive(VirtualDirect
ORY sourceVdir,字符串destPhysicalDir,布尔的顶层)
   在System.Web.Compilation.BuildManager.CopyStaticFilesRecursive(VirtualDirect
ORY sourceVdir,字符串destPhysicalDir,布尔的顶层)
   在System.Web.Compilation.BuildManager.CopyStaticFilesRecursive(VirtualDirect
ORY sourceVdir,字符串destPhysicalDir,布尔的顶层)
   在System.Web.Compilation.BuildManager。precompileAppInternal(VirtualPath星
tingVirtualDir)
   在System.Web.Compilation.BuildManager。precompileApp(VirtualPath startingVirt
ualDir)
   在System.Web.Compilation.BuildManager。precompileApp(ClientBuildManagerCallba
CK回调)
   在System.Web.Compilation.BuildManagerHost。precompileApp(ClientBuildManagerCa
llback回调)
   在System.Web.Compilation.BuildManagerHost。precompileApp(ClientBuildManagerCa
llback回调)
   在System.Web.Compilation.ClientBuildManager。precompileApplication(ClientBuil
dManagerCallback回调,布尔forceCleanBuild)
   在System.Web.Compilation.ClientBuildManager。precompileApplication(ClientBuil
dManagerCallback回调)
   在System.Web.Compilation。precompiler.Main(字串[] args)

我用下面的命令行:

  aspnet_compiler.exe -p D:\\ code \\网站\\ brokerweb -v / D:\\ code \\ \\网站公布-f -c -errorstack -u


解决方案

此错误发生在我,当我试图用MSBUILD来编译项目 - 这将在Visual Studio中建立罚款,甚至会调试在我的本地浏览器。在VS的发布选项的工作,以及。但是,命令行MSBUILD是导致项目每次都报错了。

我设法在我的网站打开属性页,打开'的MSBuild选项选项卡,取消勾选允许这台precompiled网站是更新选项,然后单击回车修复在VS 2012这个问题'救所有。

I am getting fed up with this error. I have search all over the web and tried every possible suggestion to this error I could find.

  1. delete app_code, build, add files back, publish. (did not work)
  2. delete temporary asp.net files (did not work)

In the end I even tried the command line and get the following stacktrace.

error ASPRUNTIME: Object reference not set to an instance of an object.

[NullReferenceException]: Object reference not set to an instance of an object.
   at System.Web.Compilation.BuildManager.CopyPrecompiledFile(VirtualFile vfile,
 String destPhysicalPath)
   at System.Web.Compilation.BuildManager.CopyStaticFilesRecursive(VirtualDirect
ory sourceVdir, String destPhysicalDir, Boolean topLevel)
   at System.Web.Compilation.BuildManager.CopyStaticFilesRecursive(VirtualDirect
ory sourceVdir, String destPhysicalDir, Boolean topLevel)
   at System.Web.Compilation.BuildManager.CopyStaticFilesRecursive(VirtualDirect
ory sourceVdir, String destPhysicalDir, Boolean topLevel)
   at System.Web.Compilation.BuildManager.PrecompileAppInternal(VirtualPath star
tingVirtualDir)
   at System.Web.Compilation.BuildManager.PrecompileApp(VirtualPath startingVirt
ualDir)
   at System.Web.Compilation.BuildManager.PrecompileApp(ClientBuildManagerCallba
ck callback)
   at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManagerCa
llback callback)
   at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManagerCa
llback callback)
   at System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuil
dManagerCallback callback, Boolean forceCleanBuild)
   at System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuil
dManagerCallback callback)
   at System.Web.Compilation.Precompiler.Main(String[] args)

I used the following command line:

aspnet_compiler.exe -p d:\code\websites\brokerweb -v / d:\code\websites\published -f -c -errorstack -u

解决方案

This error was occurring for me when I tried to compile the project with MSBUILD - it would build fine within Visual Studio, and would even Debug in my local browser. The Publish option within VS worked, as well. But the command-line MSBUILD was causing the project to error out every time.

I managed to fix this problem in VS 2012 by opening the Property Pages on my Website, opening the 'MSBuild Options' tab, and unchecking the 'Allow this precompiled site to be updatable' option, then hitting 'save all'.

这篇关于发布asp.net网站给予"未将对象引用设置到对象的实例"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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