gpt4 book ai didi

asp.net - 在本地主机上找到存储过程,但发布时找不到

转载 作者:行者123 更新时间:2023-12-02 12:43:47 24 4
gpt4 key购买 nike

我在服务器上有一个存储过程。我的本地开发和远程开发服务器使用相同的服务器。

当我在本地计算机上以调试方式运行该站点时,该站点运行良好。当我发布时,它返回:

The stored procedure 'vts_spUserGetUserIdFromUserName' doesn't exist. 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.InvalidOperationException: The stored procedure 'vts_spUserGetUserIdFromUserName' doesn't exist.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidOperationException: The stored procedure 'vts_spUserGetUserIdFromUserName' doesn't exist.]
System.Data.SqlClient.SqlCommand.DeriveParameters() +3962
System.Data.SqlClient.SqlCommandBuilder.DeriveParameters(SqlCommand command) +127
Microsoft.Practices.EnterpriseLibrary.Data.Database.DiscoverParameters(DbCommand command) +154
Microsoft.Practices.EnterpriseLibrary.Data.ParameterCache.SetParameters(DbCommand command, Database database) +114
Microsoft.Practices.EnterpriseLibrary.Data.Database.AssignParameters(DbCommand command, Object[] parameterValues) +42
Microsoft.Practices.EnterpriseLibrary.Data.Database.GetStoredProcCommand(String storedProcedureName, Object[] parameterValues) +70
Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteScalar(String storedProcedureName, Object[] parameterValues) +38
Votations.NSurvey.SQLServerDAL.User.GetUserByIdFromUserName(String userName) +226
Votations.NSurvey.WebAdmin.NSurveyAdmin.UserControls.LoginBox.ValidateCredentialsButton_Click(Object sender, EventArgs e) +168
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +11761917
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +150 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6016

存储过程肯定在那里。我对这两个 web.config 文件进行了 KDiff,没有发现任何差异。我能想到的唯一问题是,在服务器上,它位于 Web 应用程序中,作为另一个根站点的子应用程序。会不会是这个原因。它从其他应用程序继承数据库连接字符串吗?如果是这样,我有什么办法可以阻止这种行为吗?

最佳答案

检查创建存储过程的架构。

我可能会在您的帐户下创建存储过程,这就是为什么当您在本地计算机上运行它时,它能够找到 SP,而当它在服务器上的其他帐户下运行时则无法找到 SP。

关于asp.net - 在本地主机上找到存储过程,但发布时找不到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37681502/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com