如何运行c#exe应用程序? [英] how to run c# exe application?
问题描述
我创建了一个基本的应用程序,
用户可以将数据输入到应用程序,它可以创建一个excel文件并将所有输入数据保存到excel文件。
我构建了那个项目。
我在另一台计算机上运行该项目。申请正在运作。它可以创建excel文件。
但我无法将所有输入数据保存到excel文件
为什么会这样?
错误:
有关调用
的详细信息,请参阅此消息的结尾-in-time(JIT)调试而不是这个对话框。
**************异常文本**** **********
System.Data.OleDb.OleDbException(0x80004005):创建文件失败。
在System.Data.OleDb.OleDbConnectionInternal。 .ctor(OleDbConnectionString构造,OleDbConnection的连接)
$在System.Data.OleDb.OleDbConnectionFactory.CreateConnection b $ b(DbConnectionOptions选项,DbConnectionPoolKey poolKey,对象poolGroupProviderInfo,池类DBConnectionPool,的DbConnection owningObject)
在System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions选项,DbConnectionPoolKey poolKey,Object poolGroupProviderInfo,DbConnectionPool池,DbConnection owningConnect)离子,DbConnectionOptions USEROPTIONS)
$在System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection B $ B(的DbConnection owningConnection,DbConnectionPoolGroup poolGroup,DbConnectionOptions USEROPTIONS)
。在System.Data.ProviderBase.DbConnectionFactory。 TryGetConnection(DbConnection owningConnection,TaskCompletionSource`1 retry,DbConnectionOptions userOptions,DbConnectionInternal oldConnection,DbConnectionInternal&在System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(的DbConnection outerConnection,DbConnectionFactory connectionFactory的,连接)
TaskCompletionSource`1重试,DbConnectionOptions USEROPTIONS)
。在System.Data.ProviderBase。 DbConnectionClosed.TryOpenConnection(DbConnection outerConnection,DbConnectionFactory connectionFactory,TaskCompletionSource`1 retry,DbConnectionOptions userOptions)
在System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection,DbConnectionFactory connectionFactory)
在System.Data.OleDb.OleDbConnection.Open()
at Enquiry.enquiry.button1_Click(Object sender,EventArgs e)
在System.Windows.Forms.Control .OnClick(EventArgs e)
在System.Windows.Forms.Button.OnClick(EventArgs e)
在System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
在System.Windows.Forms.Control.WmMouseUp(消息&a熔点; m,MouseButtons按钮,Int32点击)
在System.Windows.Forms.Control.WndProc(消息& m)
在System.Windows.Forms.ButtonBase.WndProc(消息& m)
在System.Windows.Forms.Button.WndProc(消息& m)
在System.Windows.Forms.Control.ControlNativeWindow.OnMessage(消息& m; m)
在System.Windows.Forms.Control.ControlNativeWindow.WndProc(消息& m)
在System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd,Int32) msg,IntPtr wparam,IntPtr lparam)
**************已装载的装配** ************
mscorlib
汇编版本:4.0.0.0
Win32版本:4.0.30319.18408内置作者:FX451RTMGREL
CodeBase:file:/// C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
------ ----------------------------------
查询
汇编版本:1.0.0.0
Win32版本:1.0.0.0
CodeBase:file:/// D:/Enquiry.exe
--------------------- -------------------
System.Windows.Forms
汇编版本:4.0.0.0
Win32版本:4.0.30319.18408建者:FX451RTMGREL
基本代码:文件:/// C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4。 0_4.0.0.0__b77a5c561934e089 / System.Windows.Forms.dll
----------------------------- -----------
System.Drawing
汇编版本:4.0.0.0
Win32版本:4.0.30319.18408 FX451RTMGREL
基本代码:通过内置的文件:/// C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
系统
汇编版本:4.0.0.0
Win32版本:4.0.30319.18408内容:FX451RTMGREL
CodeBase:file: ///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0 __b77a5c561934e089 / System.dll
------------------------------------- ---
System.Data
汇编版本:4.0.0.0
Win32版本:4.0.30319.18408建立者:FX451RTMGREL
CodeBase:file:/// C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
- ---------------------------------------
System.Core
汇编版本:4.0.0.0
Win32版本:4.0.30319.18408内容:FX451RTMGREL
CodeBase:file:/// C:/ Windows / Microsoft.Net / assembly / GAC_MSIL / System.Core / v4.0_4.0.0.0__b77a5c561934e089 / System.Core.dll
--------------- -------------------------
System.Transactions
汇编版本:4.0.0.0
Win32版本:4.0.30319.18408内容:FX451RTMGREL
CodeBase:file:/// C:/Windows/Microsoft.Net/assembly/GAC_32/System.Transactions/ v4.0_4.0.0.0__b77a5c561934e089 / System.Transac tions.dll
--------------------------------------- -
Microsoft.CSharp
汇编版本:4.0.0.0
Win32版本:4.0.30319.18408
CodeBase: file:/// C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.CSharp/v4.0_4.0.0.0__b03f5f7f11d50a3a/Microsoft.CSharp.dll
------- ---------------------------------
Microsoft.Office.Interop.Excel
汇编版本:11.0.0.0
Win32版本:11.0.5530
CodeBase:file:/// C:/ Windows / assembly / GAC / Microsoft.Office.Interop.Excel / 11.0.0.0__71e9bce111e9429c / Microsoft.Office.Interop.Excel.dll
-------------------- --------------------
办公室
汇编版本:15.0.0.0
Win32版本:15.0.4420.1017
CodeBase:file:/// C:/Windows/assembly/GAC_MSIL/office/15.0.0.0__71e9bce111e9429c/office.dll
- ---------------------------------------
System.Dynamic
汇编版本:4.0.0.0
Win32版本:4.0.30319.18408
CodeBase:file:/// C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System。 Dynamic / v4.0_4.0.0.0__b03f5f7f11d50a3a / System.Dynamic.dll
--------------------------- -------------
匿名托管DynamicMethods程序集
汇编版本:0.0.0.0
Win32版本: 4.0.30319.18408通过内置:FX451RTMGREL
基本代码:文件:/// C:/Windows/Microsoft.Net/assembly/GAC_32/mscorlib/v4.0_4.0.0.0__b77a5c561934e089/mscorlib.dll
----------------------------------------
************** JIT调试**************
要启用实时(JIT)调试,此
应用程序或计算机(machine.config)的.config文件必须具有
jitDebugging值。 system.windows.forms部分。
应用程序也必须通过调试编译
启用。
例如:
< configuration>
< system.windows.forms jitdebugging =true>
启用JIT调试后,任何未处理的异常
将被发送到计算机上注册的JIT调试器
而不是由此对话框处理。
i have created a basic application,
which user can enter data to an application and it can create a excel file and save all the input data to an excel file.
and i built that project.
and i run that project in a different computer. application is working. it can create excel file.
but i can't save all input data to an excel file
why is that?
Error :
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Data.OleDb.OleDbException (0x80004005): Failure creating file.
at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.OleDb.OleDbConnection.Open()
at Enquiry.enquiry.button1_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
Enquiry
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///D:/Enquiry.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Data
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Transactions
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
Microsoft.CSharp
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.CSharp/v4.0_4.0.0.0__b03f5f7f11d50a3a/Microsoft.CSharp.dll
----------------------------------------
Microsoft.Office.Interop.Excel
Assembly Version: 11.0.0.0
Win32 Version: 11.0.5530
CodeBase: file:///C:/Windows/assembly/GAC/Microsoft.Office.Interop.Excel/11.0.0.0__71e9bce111e9429c/Microsoft.Office.Interop.Excel.dll
----------------------------------------
office
Assembly Version: 15.0.0.0
Win32 Version: 15.0.4420.1017
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/office/15.0.0.0__71e9bce111e9429c/office.dll
----------------------------------------
System.Dynamic
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Dynamic/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Dynamic.dll
----------------------------------------
Anonymously Hosted DynamicMethods Assembly
Assembly Version: 0.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/mscorlib/v4.0_4.0.0.0__b77a5c561934e089/mscorlib.dll
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitdebugging="true">
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
推荐答案
而不是使用其他机器(64位)上可能无法使用的Excel的OLEDB接口安装一些东西,尝试使用如下的组件库,它没有依赖关系: http://epplus.codeplex.com/ [ ^ ]
Instead of using OLEDB interfaces for Excel which may not be available on other machines (64bit) without installing something, try using a component library like the following which has no dependencies : http://epplus.codeplex.com/[^]
检查文件夹的权限不同的机器。你必须设置这个文件夹的管理员权限才能在文件夹中创建任何文件。
问候,
Sharmanuj
Check the permission on the folder on different machine. you have to set the administrator permissions to this folder to create any file in the folder.
Regards,
Sharmanuj
这篇关于如何运行c#exe应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!