ASP.NET调用Excel不能结束进程的解决方法

Amber实战:小分子配体MD模拟全流程避坑指南(附磷酸基团处理技巧) 本文提供了一份基于Amber软件进行小分子配体分子动力学模拟的实战避坑指南。详细解析了从晶体结构预处理、配体参数化(重点探讨AM1-BCC与RESP电荷选择)、复合物体系构建到模拟稳定性调试的全流程。特别针对磷酸基团等特殊官能团处理中常见的模拟崩溃问题,给出了系统性的诊断与解决方案,旨在帮助研究者获得稳定可靠的模拟结果。 阅读详情

 

关于在asp.net中调用Excel组件不能结束进程的问题,常见的解决方法用的是下面这段代码

wb.Close( null , null , null );
app.Workbooks.Close();
app.Quit();

if (rng  !=   null )
{
    System.Runtime.InteropServices.Marshal.ReleaseComObject(rng);
    rng 
= null;
}

if (ws  !=   null )
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(ws);
    ws 
= null;
}

if (wb  !=   null )
{  System.Runtime.InteropServices.Marshal.ReleaseComObject(wb);
    wb 
= null;
}

if (app  !=   null )
{ System.Runtime.InteropServices.Marshal.ReleaseComObject(app);
app 
= null;
}

GC.Collect();

        虽然这段代码在配置正确的情况下能自动结束Excel进程,但是前提是在操作Excel时没有引发异常的情况下,如果有异常发生,那么Excel进程将不能结束(比如:引用了一个在Excel文件中不存在的文本框时就会出现“HRESULT 中的异常:0x800A03EC。”),这时就要借助Process类的Kill()方法来结束,下面是我写的测试代码:

using  System;
using  System.Diagnostics;
using  excel  =  Microsoft.Office.Interop.Excel;

namespace  ExcelTest
{
    
/// <summary>
    
/// Excel的摘要说明。
    
/// </summary>

    public class Excel
    
{
        
private DateTime beforeTime;            //Excel启动之前时间
        private DateTime afterTime;                //Excel启动之后时间

        excel.Application app;
        excel.Workbook wb;
        excel.Worksheet ws;
        excel.Range rng;
        excel.TextBox tb;

        
public Excel(string templetPath)
        
{
            
//实例化一个Excel Application对象并使其可见
            beforeTime = DateTime.Now;
            app 
= new excel.ApplicationClass();
            app.Visible 
= true;
            afterTime 
= DateTime.Now;

            wb 
= app.Workbooks.Open(templetPath,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing);
            ws 
= (excel.Worksheet)wb.Worksheets.get_Item(1);
        }


        
public void ExcelMethod()
        
{
            rng 
= ws.get_Range("B5","C7");
            rng.Merge(excel.XlAxisCrosses.xlAxisCrossesAutomatic);
            rng.Value2 
= "Excel2003";

            rng 
= ws.get_Range("D8","E11");
            rng.MergeCells 
= true;
            rng.Value2 
= "Excel2003";
            rng.HorizontalAlignment 
= excel.XlHAlign.xlHAlignCenter;
            rng.VerticalAlignment 
= excel.XlVAlign.xlVAlignCenter;

            rng 
= ws.get_Range("A1",Type.Missing);
            rng.Value2 
= 5;

            rng 
= ws.get_Range("A2",Type.Missing);
            rng.Value2 
= 7;

            
for(int i=1;i<100;i++)
            
{
                
string s = string.Concat("G",i.ToString());
                rng 
= ws.get_Range(s,Type.Missing);
                rng.Value2 
= i.ToString();
            }


            tb 
= (excel.TextBox)ws.TextBoxes("文本框 1");
            tb.Text 
= "作 者";

            tb 
= (excel.TextBox)ws.TextBoxes("文本框 2");
            tb.Text 
= "KLY.NET的Blog";

            tb 
= (excel.TextBox)ws.TextBoxes("文本框 3");
            tb.Text 
= "日 期";


            
try
            
{
                tb 
= (excel.TextBox)ws.TextBoxes("文本框 5");
                tb.Text 
= DateTime.Now.ToShortDateString();
            }

            
catch
            
{
                
//这里用Dispose()方法结束不了Excel进程,所有还是要用Process的Kill()方法配合使用
                
//                this.Dispose();
                this.KillExcelProcess();
                
throw new Exception("不存在ID为/"文本框 5/"的文本框!");
            }

            
finally
            
{
                
//如果有异常发生,Dispose()方法放在这里也结束不了Excel进程
//                this.Dispose();

                
//如果发生异常,在这里也可以结束Excel进程
//                this.KillExcelProcess();
            }

        }


        
/// <summary>
        
/// 另存为Excel文件
        
/// </summary>
        
/// <param name="savePath">保存路径</param>

        public void SaveAsExcelFile(string savePath)
        
{
            wb.SaveAs(savePath,excel.XlFileFormat.xlHtml,Type.Missing,Type.Missing,Type.Missing,Type.Missing,excel.XlSaveAsAccessMode.xlExclusive,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing);
        }


        
/// <summary>
        
/// 结束Excel进程
        
/// </summary>

        public void KillExcelProcess()
        
{
            Process[] myProcesses;
            DateTime startTime;
            myProcesses 
= Process.GetProcessesByName("Excel");

            
//得不到Excel进程ID,暂时只能判断进程启动时间
            foreach(Process myProcess in myProcesses)
            
{
                startTime 
= myProcess.StartTime;

                
if(startTime > beforeTime && startTime < afterTime)
                
{
                    myProcess.Kill();
                }

            }

        }


        
/// <summary>
        
/// 如果对Excel的操作没有引发异常的话,用这个方法可以正常结束Excel进程
        
/// 否则要用KillExcelProcess()方法来结束Excel进程
        
/// </summary>

        public void Dispose()
        
{
            wb.Close(
null,null,null);
            app.Workbooks.Close();
            app.Quit();

            
//注意:这里用到的所有Excel对象都要执行这个操作,否则结束不了Excel进程
            if(rng != null)
            
{
                System.Runtime.InteropServices.Marshal.ReleaseComObject(rng);
                rng 
= null;
            }

            
if(tb != null)
            
{
                System.Runtime.InteropServices.Marshal.ReleaseComObject(tb);
                tb 
= null;
            }

            
if(ws != null)
            
{
                System.Runtime.InteropServices.Marshal.ReleaseComObject(ws);
                ws 
= null;
            }

            
if(wb != null)
            
{
                System.Runtime.InteropServices.Marshal.ReleaseComObject(wb);
                wb 
= null;
            }

            
if(app != null)
            
{
                System.Runtime.InteropServices.Marshal.ReleaseComObject(app);
                app 
= null;
            }


            GC.Collect();
        }

    }

}

        这段代码能很好的解决Excel进程不能正常结束的问题,如果主机操作系统不是服务器版的话,那么就要借助于ntsd -c q -p pid命令来结束。
        还有一个问题的关于Excel组件访问权限的配置,一定要在组件服务里面正确配置,否则结束不了Excel进程,具体的配置方法在我项目的doc文件夹下;在我前面的文章里面介绍了在web.config文件里面加入假扮用户的方法,但是经我测试发现这种方法虽然可以访问Excel组件,但是结束不了进程,除非用Kill方法强行结束。

点这里下载ExcelTest.rar

【20】方案管理器 方案管理器是Excel中一个非常强大且灵活的工具,适合用于多情景分析和比较。在复杂的决策过程中,它可以帮助用户快速管理和评估不同变量组合下的结果,从而优化决策过程。 阅读详情

相关推荐

开关电源环路学习笔记(1)-为啥要知道传递函数?

做硬件都会接触到开关电源,或多或少会接触到环路补偿。很多兄弟们也提出来让我说说这个,说明大家也都很关心,也说明这个好像有点难。 就我个人而言,我也想搞明白环路这一块,也查了一些资料,视频,不过说实话,一直都还是懵的,感觉很困难。 具体感觉就是,看资料或视频的时候,感觉好像是那么回事。但是撇开之后,就又云里雾里的感觉,总有一些想法没有找到答案。 问题 比如下面我想过的问题: 开关电源有开关,根本就不是一个线性系统,传递函数是咋弄出来的? 系统环路框图的输入量为什么不是Vin,而是参考电压V

weixin_42005993的博客 1万+

关于ASP.NET中调用Excel组件不能结束进程的解决方法

        关于在asp.net中调用Excel组件不能结束进程的问题,常见的解决方法用的是下面这段代码 wb.Close(null,null,null);app.Workbooks.Close();app.Quit();if(rng != null){    System.Runtime.InteropServices.Marshal.ReleaseComObject(rng);    r...

weixin_33721427的博客 244

Arduino IDE 2.3.2 配置 UNO R4 WIFI 开发环境避坑指南(附LED矩阵驱动测试)

本文详细介绍了如何在Arduino IDE 2.3.2中配置UNO R4 WIFI开发环境,并提供了LED矩阵驱动的实战指南。从开发环境搭建到硬件连接,再到LED矩阵的初始化和弹球动画实现,手把手教你避开常见配置陷阱,最终实现流畅的动画效果。特别适合刚接触UNO R4 WIFI的开发者快速上手。

weixin_28675839的博客 223

在asp.net中操作excel,excel进程无法关闭解决方法(亲测有效)

这个问题纠缠我好几天了,终于在无数的解决方案中找到了有效的 具体实现如下: [DllImport(“User32.dll”, CharSet = CharSet.Auto)] public static extern int GetWindowThreadProcessId(IntPtr hwnd, out int ID); public static void Kill(Microsoft.Office.Interop.Excel.Application excel) { excel.Quit(); In

crystal4000的博客 868

IGV实战指南:从数据导入到Peak可视化的全流程解析

本文提供了一份IGV实战指南,详细解析了从数据导入到Peak可视化的全流程。内容包括软件安装、参考基因组加载、测序数据处理、信号调整以及如何精准定位和可视化Peak区域,并分享了导出出版级矢量图的高级技巧,帮助用户高效完成基因组数据可视化分析。

weixin_29212867的博客 154

告别环境配置噩梦:用Docker Desktop + WSL2在Windows上5分钟搞定vLLM运行环境

本文详细介绍了如何在Windows系统上使用Docker Desktop和WSL2快速搭建vLLM开发环境,5分钟内完成配置。通过容器化技术解决传统环境配置中的依赖冲突、环境污染等问题,提供一键复用的高效方案,特别适合AI开发者快速部署和测试vLLM框架。

weixin_28728495的博客 507

WPF应用程序在窗体全关闭后无法退出进程的解决办法之一

WPF(C#)应用程序在窗体全关闭后无法退出程序、无法退出进程的解决办法之一 一、可能导致无法退出进程的原因 进程中有非后台线程仍然在运行:应检查是否存在Thread类实例化的线程,然后确认是否都设为了后台线程。 其他可能的原因:Application.MainWindow在程序中被置为null——这个是猜测的,因为我遇到了一次出现无法退出进程的情况,但检查过了各个线程应该没有前台线程且应该都是...

ncsbbss的博客 6303

新华硕笔记本ubuntu18.04双系统安装之后,wifi没有显示无法链接wifi

本来我以为跟简单安装一个wifi网卡的驱动就可以解决的问题,没想到花了我一早上的时候解决… 惭愧。 另外,本来是没打算写这篇博客的,但是我在搜索解决这个问题的过程中, 发现多人提出的解决方案跟我的都不一样,甚至我的解决方案都没有搜到相应的答案,还是只能靠自己啊。。 言归正传,还是说说怎么正确的安装wifi驱动吧! 1. wifi没有正确安装、或没有正确配置的表现 我的电脑现象: 有wifi图标, wifi设置上显示unaviable,无法搜索到任何wifi; 还有其他类似的表现,大家可以看看其他朋友的提

Ian的博客 1893

ASP.NET Core 基础(八)——日志记录

日志组件包括提供器(Provider)和记录器(Logger) # 1.日志提供程序(Log provider) 框架自带的日志provider有以下几种,前4个都在`CreateDefaultBuilder`里被添加进去,后续几个需要添加nuget包。 - 控制台:即`Consol.WriteLine()` - 调试:即`Debug.WriteLine()` - EventSource:EventSource 提供程序写入名称为 Microsoft-Extensions-Logging 的跨平台事件源。

catshitone的专栏 1633

【行业解决方案篇十五】【DeepSeek物流优化:车辆路径规划算法】

写完这篇技术解析,突然想起那位多绕150公里的王师傅——现在他的车载平板会实时显示"路径健康度",当偏离最优路线超过5%就自动报警。从节约算法到深度强化学习,从三维装载到时序预测,这些技术最终化作每辆货车少烧的1升柴油,每个快递小哥早回家的1小时。最后说个浪漫的事:系统曾为某偏远山区规划出一条穿越枫叶林的配送路线,不仅节省23公里,还成了网红打卡路线。原来物流优化的尽头,不仅是冰冷的数学,还有人间烟火气的温度。

商务合作|问题讨论|交流学习 请联系作者微信,加微信请务必注明来意,博客主页有联系方式 297

大模型微调部署实战及类GPT工具的高效使用

本文主要介绍了专栏《大模型微调部署实战及类GPT工具的高效使用》的核心内容,希望对使用大语言模型的同学们有所帮助。 文章目录 1. 前言 2. 专栏亮点 3. 你的收获 4. 详细目录

herosunly的博客 22万+

【转】在ASP.NET中调用Excel组件不能结束进程的解决方法

在asp.net中调用Excel组件不能结束进程的问题,常见的解决方法用的是下面这段代码 wb.Close(null,null,null); app.Workbooks.Close(); app.Quit(); if(rng!=null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(rng)...

weixin_30550271的博客 140

基于改进Unet的多场景水果图像分割与分类研究

本文针对复杂场景下的水果图像分割问题,提出了一种改进Unet模型。通过构建包含8类水果、3种成熟度及多种干扰场景的数据集,采用ResNet50与MobileNetV3作为骨干网络,并在跳跃连接层集成CBAM注意力机制。实验表明,改进模型在测试集上达到91.6%的mIoU,推理速度提升23%,特别在重叠水果和低光照场景表现突出。研究为农业视觉检测提供了有效解决方案。

AI的内部世界的博客 309

Asp.net 中导出excel后终止进程的解决办法

在asp.net里使用com组件导出excel后总是会有一个EXCEL.EXE进程存在,占据着30多M的内存,研究了好久试了网上的很多办法都没有解决。今天心情比较放松,接着从网上搜了一下,看到一篇帖子如下:   在DOT NET中调用Excel后,Excel进程的并未终止问题的解决办法 收藏 在DOT NET中调用Excel后,Excel进程的并未终止问题Excel.Applicati

yuff0408的专栏 1628

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

C#和Asp.net下调用Excel后无法自动关闭进程的解决方法

在ASP.NET中调用EXCEL后(比如导出EXCEL),EXCEL长驻内存的解决办法就是---干掉它!!! 原帖地址: http://hi.baidu.com/cnzynet/blog/item/b7d1a0f22dc00315b17ec50f.html 添加引用: using System.Runtime.InteropServices; 结束进程代码 [...

a791442573的博客 211

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

asp.net调用Console程序,异常未结束的处理。

    因一年前用asp.net开发了一套B/S结构的备品管理系统,   因财务作帐的需求,备品的数据要与生产用的OpenVms的数据进行交互。故用写了两支Console程序,一支从OpenVms系统写入SQL,一支从SQL写入OpenVms系统。两支程序由asp.net的页调用,当用户点击页面上的按钮时,再运行console程序。    最近发现用户调用程序时,写入OPENVMS的CONSO

Vincent.woo(文子) 1675

在DOT NET中调用Excel后,Excel进程的并未终止问题的解决办法

在DOT NET中调用Excel后,Excel进程的并未终止问题Excel.Application myExcel = new Excel.Application() ;...myExcel.Quit();网上的解决办法大多是说在myExcel.Quit()后强制进行垃圾回收GC.Collect();但是都不行,还有人说要释放对该Com对象(myExcel)的引用for(int i =1;i>0;

蓝色沙滩 4117

ASP.NET导出Excel并将Excel进程关闭 (根据进程ID)

开发工作中经常遇到跟Excel打交道的地方,但在ASP.NET中使用完Excel后往往不能将其关闭,导致服务器上的Excel进程越来越多.本文介绍一个直接将进程KILL的方法,根据进程ID来KILL,不会影响其他用户的操作. 完整EXCEL导出及结束代码参考如下: using System; using System.Collections; using System.Configuratio

kogu的博客 5508

在asp.net中操作excel如何关闭excel的进程

在asp.net中操作excel经常会出现关闭不了后台excel进程的情况,本人最近搜索了一些资料, 已可以成功在程序中关闭excel,代码如下: Excel.Application myExcel;Excel._Workbook myWB;Excel._Worksheet myWS = null;Excel.Range myRange = null; string filePath = Serv

平凡的人 3500

asp.net导出数据到Excel的方法(完全无组件,不用调用Excel.exe)

asp.net导出数据到Excel的方法(完全无组件,不用调用Excel.exe), http://www.pccode.net/info/2011/03/06/20110306-7149.html

WYZSC的专栏 2862

asp.net 导入excel并删除进程

在Asp.net中建立本地的Excel表,并由服务器向外传播是容易实现的,而删除掉嵌入的Excel.exe进程是困难的。所以 你不要打开任务管理器 ,看Excel.exe进程相关的东西是否还在内存里面。我在这里提供一个解决方案 ,里面提供了两个方法 : "CreateExcelWorkbook"(说明 建立Excel工作簿) 这个方法 运行一个存储过程 ,返回一个DataReader 并根据D

deansroom的专栏 1277

asp.net导出数据到Excel的几种方法(2/3)

     继续前文,第二种方法是利用Excel的Com接口库来完成,这种方法的优点是功能强大,可像使用Excel程序一样来操作Excel文件,缺点是需要服务器安装Excel程序,且需要一定的安全配置。一、准备工作:1)安装Microsoft Excel2)Com的安全设置。   在命令行输入DCOMCNFG ,进入组件服务设置界面,如图:打到Micorosoft Excel

cpp2017(慕白兄)的专栏 8496

ASP.NET 访问Excel 失败的解决方法

ASP.NET 调用Excel时出错:检索 COM 类工厂中 CLSID 为{00024500-0000-0000-C000-000000000046} 的组件时失败,原因是出现以下错误: 80070005。 解决方法:1:在服务器上安装office的Excel软件.(若已安装则跳过此步骤)2:在"开始"->"运行"中输入dcomcnfg.exe启动"组件服务"3:依次双击

Driftwing 806

在ASP.NET中结束EXCEL进程的程序

        结束 Excel 进程        Dim xlProcess As New System.Diagnostics.Process        For Each xlProcess In System.Diagnostics.Process.GetProcesses            If xlProcess.ProcessName.ToUpper.Equals("EXC

changhaozheng的专栏 790
上一篇: ASP.NET操作EXCEL时出现的错误 Retrieving the COM class factory for component with CLSID
下一篇: Asp.net 操作Excel 无法关闭解决方法之一
hack8
博客等级 码龄18年 109粉丝 128原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址