【发布时间】:2011-09-05 00:06:44
【问题描述】:
想在我的服务器上运行 asp.net 的 exe,这可能吗?
我用这个方法:
System.Diagnostics.Process process1 = new System.Diagnostics.Process();
// Set the directory where the file resides
process1.StartInfo.WorkingDirectory = @"D:\dev\Analyzer\bin\Release";
// Set the filename name of the file you want to open
process1.StartInfo.FileName = @"D:\dev\Analyzer\bin\Release\Analyzer.exe";
process1.StartInfo.Arguments = "123";
// Start the process
process1.Start();
当我调试它时它可以工作,但是当我把我的网站放在本地主机上时,我有异常:
用户“IIS APPPOOL\dq”登录失败
其中 dq 是我的网站名称。
堆栈:
System.Data.SqlClient.SqlException (0x80131904):用户 'IIS APPPOOL\dq' 登录失败。在 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException 异常,布尔型 breakConnection) 在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() 在 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,SqlCommand cmdHandler,SqlDataReader dataStream,BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) 在 System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) 在 System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject) 在 System.Data。 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject,TimeoutTimer 超时,SqlConnectionString connectionOp在 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) 在 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions)在 System.Data 的 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) 的 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) 的选项、对象 poolGroupProviderInfo、DbConnectionPool 池、DbConnection owningConnection)。 ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) 在 System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) 在 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) 在 System.Data.ProviderBas e.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at System.Data.Linq.SqlClient.SqlConnectionManager.UseConnection(IConnectionUser user) at System.Data.Linq.SqlClient.SqlProvider .get_IsSqlCe() 在 System.Data.Linq.SqlClient.SqlProvider.InitializeProviderMode() 在 System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(表达式查询) 在 System.Data.Linq .DataQuery`1.System.Collections.Generic.IEnumerable.GetEnumerator() at Analyzer.Program.Main(String[] args) 在 D:\dev\Analyzer\Program.cs:line 59
【问题讨论】:
-
请提供完整的异常细节。如果没有细节,说抛出异常是没有用的。
-
网站使用什么用户帐户,是否有权访问这些文件?
-
此外,它还需要某些 .net 权限,而大多数主机可能不会授予这些权限。
-
你在哪一行得到这个异常?它与您发布的代码无关,除非这是由您的
analyser.exe抛出的。 -
还有什么例外?我假设
TdsParser被 SQL 卡住了。
标签: c# asp.net iis windows-server-2008