System.Data.SqlClient.SqlException:用户'...'登录失败(System.Data.SqlClient.SqlException: login failed for user '…')
我没有使用集成安全性。 我在网上看了这个问题并尝试解决错误。 到目前为止没有任何工作或解决它。 它在visual studio中不适用于iis和debug。 这是我得到的错误:
详细信息van uitzondering: System.Data.SqlClient.SqlException:用户'.....'登录失败。
支气管:
Regel 7: { Regel 8: SqlConnection myconnection = new SqlConnection(ConnectionClass.cnnConnectionVacature); Regel 9: myconnection.Open(); Regel 10: Regel 11: //het laten zien van ingevoerde database gegevens
Bronbestand: c:\ inetpub \ wwwroot \ Vacaturesite \ start.aspx.cs Regel:9
Stacktracering:
[SqlException (0x80131904): Login failed for user 'BPVICTwebuser'.] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5340655 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +244 System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1691 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +69 System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +30 System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +317 System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) +891 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) +307 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData) +518 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +278 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +38 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +732 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +85 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +1057 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +78 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +196 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +146 System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +16 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +94 System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +110 System.Data.SqlClient.SqlConnection.Open() +96 Start.Page_Init(Object sender, EventArgs e) in c:\inetpub\wwwroot\Vacaturesite\start.aspx.cs:9 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51 System.Web.UI.Control.OnInit(EventArgs e) +92 System.Web.UI.Page.OnInit(EventArgs e) +12 System.Web.UI.Control.InitRecursive(Control namingContainer) +134 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +489
这里是一些代码:
public static string cnnConnectionVacature { get { return @"Data Source=SX047H\SQLEXPRESS;Initial Catalog=BPVICT_vacature;User ID=...;Password=..."; } }
I use no Integrated Security. I've looked this problem up online and tried solving the error. So far nothing worked or solved it. It doesn't work with both iis and debug in visual studio. This is the error I'm getting:
Details van uitzondering: System.Data.SqlClient.SqlException: Login failed for user '.....'.
Fout in bron:
Regel 7: { Regel 8: SqlConnection myconnection = new SqlConnection(ConnectionClass.cnnConnectionVacature); Regel 9: myconnection.Open(); Regel 10: Regel 11: //het laten zien van ingevoerde database gegevens
Bronbestand: c:\inetpub\wwwroot\Vacaturesite\start.aspx.cs Regel: 9
Stacktracering:
[SqlException (0x80131904): Login failed for user 'BPVICTwebuser'.] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5340655 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +244 System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1691 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +69 System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +30 System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +317 System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) +891 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) +307 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData) +518 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +278 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +38 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +732 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +85 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +1057 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +78 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +196 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +146 System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +16 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +94 System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +110 System.Data.SqlClient.SqlConnection.Open() +96 Start.Page_Init(Object sender, EventArgs e) in c:\inetpub\wwwroot\Vacaturesite\start.aspx.cs:9 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51 System.Web.UI.Control.OnInit(EventArgs e) +92 System.Web.UI.Page.OnInit(EventArgs e) +12 System.Web.UI.Control.InitRecursive(Control namingContainer) +134 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +489
here is some of the code:
public static string cnnConnectionVacature { get { return @"Data Source=SX047H\SQLEXPRESS;Initial Catalog=BPVICT_vacature;User ID=...;Password=..."; } }
原文:https://stackoverflow.com/questions/28210615
最满意答案
性能基本相同,因为在两种情况下都会发生基本相同的事情。 例如,在UNIX / Linux平台上:
- 当前流程是“分叉”的。
- 新的子进程'exec'是'java'命令,传递指定的命令行参数。
- 子JVM启动......
可能存在次要性能差异。 例如,父母处理孩子的标准输入/输出/错误流的方式可能不同。 但通常你会忘记这种事情。
[正如@Amadan指出的那样,使用类加载器在当前JVM中启动Java应用程序效率要高得多......因为它避免了JVM启动的开销,JIT编译公共代码等等。但主要的缺点是(除了简单)是“父”应用程序没有有效的方法来控制在同一个JVM中运行的“子”应用程序。 如果孩子陷入困境或者资源管理通常很草率,那么父母也会受到影响。
The performance is essentially the same, because the essentially the same thing is happening in both cases. For example, on a UNIX / Linux platform:
- The current process is 'forked'.
- The new child process 'exec's the 'java' command, passing the specified command line arguments.
- The child JVM starts ...
There might be secondary performance differences. For example in the way that the child's standard input / output / error streams get handled by the parent may be different. But usually you can forget about this kind of thing.
[As @Amadan notes, using a class loader to launch the Java application in the current JVM is considerably more efficient ... because it avoids the overheads of JVM startup, JIT compilation of common code, etc. But the main downside (apart from simplicity) is that there's no effective way for the "parent" application to control a "child" application that is running in the same JVM. If the child gets stuck in a loop or is generally sloppy with resource management, the parent suffers too.]
相关问答
更多-
无法从Runtime.getRuntime()启动Steam.exe。exec(..)(Cannot start Steam.exe from Runtime.getRuntime().exec(..))[2022-10-25]
我能够通过删除start来运行它。 Runtime.getRuntime().exec("cmd.exe \"C:/Program Files (x86)/Steam/Steam.exe\" -login myid mypassword"); 即使删除cmd.exe也起作用 Runtime.getRuntime().exec("\"C:/Program Files (x86)/Steam/Steam.exe\" -login myid mypassword"); 但是我碰到了一个很小的问题,我会再问一次 ... -
终于找到了罪魁祸首。 显然,运行时进程不仅提供输入流( Process#getInputStream ),还提供错误流( Process#getErrorStream )。 错误流也填满了,因为外部程序给出了关于文件格式错误的一些错误。 解决方案包括创建一个新的runnable类,该类从一个单独的线程中的流中读取。 然后,主线程将创建此对象的两个实例,一个将从输入流中读取,另一个将从错误流中读取,然后让两个实例异步运行其线程。 这样两个流同时被读取,主线程将调用Process#waitFor 。 我希望这可 ...
-
Runtime.exec返回一个Process实例,您可以使用它来监视状态。 Process process = Runtime.getRuntime().exec(command); boolean finished = process.waitFor(3, TimeUnit.SECONDS); 最后一行可以放入循环,或者只设置合理的超时。 Runtime.exec returns a Process instance, which you can use to monitor the status. ...
-
Runtime.getRuntime()。exec()不执行某些命令(Runtime.getRuntime().exec() doesn't execute some commands)[2023-08-14]
cd命令是shell内置命令。 通过exec(...)运行命令时没有shell。 实际上,如果你试图在任何系统的bin目录中找到cd命令,你将找不到一个...因为它不可能作为常规命令实现。 如果您尝试使用cd来更改JVM本身的当前目录,那将无法工作,因为命令只能更改自身的当前目录,并且(之后)命令它自己启动。 它无法更改其父进程当前目录。 如果您尝试使用cd来更改后续命令的当前目录,那么这也无效。 命令完成时,设置当前目录的上下文结束。 事实上,使用exec更改命令运行目录的正确方法是通过ProcessBu ... -
Android - 交互式shell(Runtime.getRuntime()。exec())(Android - Interactive shell (Runtime.getRuntime().exec()))[2023-01-20]
OP解决方案。 不使用Android中的工具stdbuf (coreutils)我找到了下一个解决方案: 我正在使用两个名为process1和process2的进程:两个 - > new ProcessBuilder(new String[]{"su", "-c", "sh"}).start(); 在第一个过程中,我运行wpa_cli dos1.write("wpa_cli".getBytes()); dos1.flush(); 在一个线程中,我等待5秒,然后在第二个进程中运行wpa_cli。 dos2. ... -
Java Runtime.getRuntime()。exec丢失/更改一些参数(Java Runtime.getRuntime().exec looses/changes some parameters)[2023-03-10]
发现cmdLine.add("-Dmaven.test.skip=true"); 也会因类似的错误而变得true 。 我注意到在JavaDoc中没有提到Runtime.getRuntime().exec(的这种行为Runtime.getRuntime().exec( 通过将所有选项放在一个字符串中解决。 cmdLine.add(mavenPath); cmdLine.add(mavenOptions+" compile exec:java -Dexec.mainClass="+package ... -
您可以逐个字符 (或一次一组字符)而不是逐行读取它。 BufferedReader br = getBufferedReader(inputStream); setInfosProcess(null); char[] cbuf = new char[1024]; // Adjust the length of the array to suit your needs. StringBuilder outputBuilder = new StringBuilder(); try { while ((S ...
-
使用Runtime.getRuntime().exec时,应该显式关闭输入/输出流。 Process p = null; try { p = Runtime.getRuntime().exec("ls -l"); //process output here p.waitFor(); } finally { if (p != null) { p.getOutputStream().close(); p.getInputStream().close ...
-
您可以使用PowerMockito和mockStatic方法执行此操作。 我们的想法是模拟静态Runtime.getRuntime()方法来返回一个模拟的运行时对象,然后你可以控制exec()的结果 @RunWith(PowerMockRunner.class) @PrepareForTest(Runtime.class) public class TestClass { @Mock private Runtime mockRuntime; @Test public void test() ...
-
“Runtime.getRuntime()。exec()”表现不好吗?(Does “Runtime.getRuntime().exec()” have a bad performance?)[2023-10-15]
性能基本相同,因为在两种情况下都会发生基本相同的事情。 例如,在UNIX / Linux平台上: 当前流程是“分叉”的。 新的子进程'exec'是'java'命令,传递指定的命令行参数。 子JVM启动...... 可能存在次要性能差异。 例如,父母处理孩子的标准输入/输出/错误流的方式可能不同。 但通常你会忘记这种事情。 [正如@Amadan指出的那样,使用类加载器在当前JVM中启动Java应用程序效率要高得多......因为它避免了JVM启动的开销,JIT编译公共代码等等。但主要的缺点是(除了简单)是“父 ...