本文介绍了执行页面计数时服务器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

未将对象设置为对象实例错误消息一旦将项目放置在服务器上(尽管它在本地计算机上运行良好),就会弹出错误消息.

服务器错误
对象引用未设置为对象的实例.
说明:执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息.

异常详细信息:System.NullReferenceException:对象引用未设置为对象的实例.

源错误:


Object not set to an instance of object error message is poping up once i placed the project on the server though it was working fine on the the local machine.

Server Error
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Microsoft.Office.Interop.Word.WdStatistic stat = Microsoft.Office.Interop.Word.WdStatistic.wdStatisticPages;
count = aDoc.ComputeStatistics(stat, ref missing);//error occuring in this line of code.
WordApp.Quit(ref objDNS, ref missing,/ ref missing);



可能是问题所在.....谢谢



What could be the issue.....thanks

推荐答案

var appWord = new Application { Visible = false };
object oMissing = Missing.Value;
Document aDoc = appWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing);



如果遇到任何问题,请回复.



Please revert back, if you face any issue.


这篇关于执行页面计数时服务器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 09:52