在堆栈跟踪中引用本地路径

时间:2014-07-29 06:39:29

标签: c# asp.net .net

当我尝试在远程服务器上加载我的网站时出错。 这是堆栈跟踪

  

[SqlException(0x80131904):与网络相关或特定于实例的   建立与SQL Server的连接时发生错误。该   服务器未找到或无法访问。验证该实例   名称是正确的,并且SQL Server配置为允许远程   连接。 (提供者:SQL网络接口,错误:26 - 错误   找到指定的服务器/实例)]
  System.Data.SqlClient.SqlInternalConnection.OnError(SQLEXCEPTION   exception,Boolean breakConnection,Action 1 wrapCloseInAction) +6749670 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +815
System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover) +6775368
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +219
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) +6777754
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) +6778255
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData) +878
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +816
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +72
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +6781425
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +103
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +2105
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource
1 retry,DbConnectionOptions   userOptions,DbConnectionInternal&连接)+116
  System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(的DbConnection   owningConnection,TaskCompletionSource 1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +1089
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource
1次重试,DbConnectionOptions userOptions)   +6785863 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource 1 retry) +233
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource
1   重试)+278 System.Data.SqlClient.SqlConnection.Open()+239
  System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context,   Boolean revertImpersonate)+150
  System.Web.DataAccess.SqlConnectionHelper.GetConnection(字符串   connectionString,Boolean revertImpersonation)+4915718
  System.Web.Security.SqlRoleProvider.RoleExists(String roleName)+967
  System.Web.Security.Roles.RoleExists(String roleName)+336
  Bat.Web.Global.Application_Start(Object sender,EventArgs e)中   C:\用户\巴特尔\文件\ GitHub的\ batconnect \主\ batconnect \ Bat.Web \ Global.asax.cs中:15

正如您在最后一行中所看到的,有一个对我本地计算机的引用:

Bat.Web.Global.Application_Start(Object sender, EventArgs e) in c:\Users\Bartel\Documents\GitHub\batconnect\Main\batconnect\Bat.Web\Global.asax.cs:15

谁能告诉我,为什么会这样?以及如何解决它。

亲切的问候, 文森特

1 个答案:

答案 0 :(得分:1)

此信息来自PDB文件,除非您不想公开此路径,否则无需修复此问题。在这种情况下,您可以完全关闭PDB的生成:转到项目设置,构建属性,选择 Release 配置(我假设您正在使用它) ,单击高级... 按钮并选择调试信息