求大侠帮看看,mvc开发用rdlc开发报表是连不上数据库

Aimar147 2016-10-12 12:04:58
数据库服务器和网页服务器分开。
数据库服务器:Win2003server , sqlserver2008R2
网页服务器:win2008,IIS7
使用mvc模式开发
程序模块都没问题,和数据库操作也没有问题,只是一点击报表查询就出错,报表是用rdlc做的,调的是aspx文件。实在急的要命,请帮忙解决,谢谢。
报错如下:
Server Error in '/' Application.
找不到网络路径。
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.ComponentModel.Win32Exception: 找不到网络路径。

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:


[Win32Exception (0x80004005): 找不到网络路径。]

[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)]
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) +1162
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& connection) +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 retry, DbConnectionOptions userOptions) +6785863
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +233
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +278
System.Data.SqlClient.SqlConnection.Open() +239
Hotlan.Public.DBUtility.DbHelperSQL.RunProcedure(String storedProcName, IDataParameter[] parameters, String tableName) +128
Hotlan.BLL.TrafficFlowBLL.GetTxfzslist(DateTime Begindate, DateTime Enddate, String UserId) +1776
Hotlan.SFGL.AspNets.RdlcTrafficView.Button1_Click(Object sender, EventArgs e) +312
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +155
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804
...全文
225 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_31587461 2017-11-13
  • 打赏
  • 举报
回复
我的也是数据库到RDLC那个页面就显示数据库连接不上的问题,大神哪,指点一下呗
qq_31587461 2017-11-13
  • 打赏
  • 举报
回复
怎么解决的啊?最近也在弄这个唉呀
Aimar147 2016-10-12
  • 打赏
  • 举报
回复
解决了,的确是两个连接不一样,谢谢
闭包客 2016-10-12
  • 打赏
  • 举报
回复
因为你说其他网页运行正常,可以操作数据库。 而 rdlc 报的错误是连接不上数据库。 所以可以断定在服务器环境中,其他网页和 rdlc 用的不是同一个连接字符串。
闭包客 2016-10-12
  • 打赏
  • 举报
回复
引用 7 楼 Aimar147 的回复:
但是在我本机运行,一点问题都没有,发布在我们的测试服务器上(数据库和网页在一台机器上)也没有问题,只是发布在实际服务器上(数据库和网页不在一台机器上)出错,所以我觉得是环境的问题
嗯,凡是在本地不出错,部署之后出错的,都需要日志文件,毕竟服务器上无法调试。 要定位这个问题,也只能在日志中记录下执行这个方法的时候的连接字符串了。
Aimar147 2016-10-12
  • 打赏
  • 举报
回复
但是在我本机运行,一点问题都没有,发布在我们的测试服务器上(数据库和网页在一台机器上)也没有问题,只是发布在实际服务器上(数据库和网页不在一台机器上)出错,所以我觉得是环境的问题
闭包客 2016-10-12
  • 打赏
  • 举报
回复
你需要在 Hotlan.Public.DBUtility.DbHelperSQL.RunProcedure(String storedProcName, IDataParameter[] parameters, String tableName) +128 这个方法设置断点,按 F11 一句一句地执行,在使用 SqlConnection 的时候查看它的连接字符串。
Aimar147 2016-10-12
  • 打赏
  • 举报
回复
我就是参照4楼那篇做的,现在的情况是,数据库和网页在一台机器上就没问题,分开就出错了,应该是网页服务器上缺点什么?
insus 2016-10-12
  • 打赏
  • 举报
回复
Aimar147 2016-10-12
  • 打赏
  • 举报
回复
数据库服务器和网页服务器分开的,而且其他的功能模块都可以用,只是这个用的是rdlc
yzf86211861 2016-10-12
  • 打赏
  • 举报
回复
先确定 能连上 数据库
shoppo0505 2016-10-12
  • 打赏
  • 举报
回复
找不到SQL服务器阿,你这个报表程序和SQL数据库是在一台机器上面么? 如果不是,那你需要启动SQL TCP/IP 服务功能。

62,041

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧