ASP.NET / SSAS / SQL Server - 现有连接被远程主机强制关闭
可能的重复:
我可以在几次情况下关闭模拟
我创建了一个应用程序,当上传到我的服务器时会引发异常。它在本地工作正常,但当我将其上传到我的服务器时,我收到以下错误:
System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
这是我的连接字符串:
AdomdConnection conn = new AdomdConnection("Data Source=BTN-SQL1;Initial Catalog=BTNTurboAnalysisServices;");
值得注意的是,BTN-SQL1 与我的 Web 服务器位于不同的服务器上,可能这会引起问题吗?我也在使用 Windows 身份验证。
下面是我的堆栈跟踪:
[SocketException (0x2746): An existing connection was forcibly closed by the remote host]
System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +245
[IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.]
System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +7856541
System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count) +253
Microsoft.AnalysisServices.AdomdClient.DimeRecord.ForceRead(Stream stream, Byte[] buffer, Int32 length) +61
Microsoft.AnalysisServices.AdomdClient.DimeRecord.ReadHeader() +53
Microsoft.AnalysisServices.AdomdClient.DimeReader.ReadRecord() +112
Microsoft.AnalysisServices.AdomdClient.TcpStream.GetResponseDataType() +120
[AdomdConnectionException: The connection either timed out or was lost.]
Microsoft.AnalysisServices.AdomdClient.XmlaClient.EndRequest() +1367
Microsoft.AnalysisServices.AdomdClient.XmlaClient.CreateSession(ListDictionary properties, Boolean sendNamespaceCompatibility) +387
Microsoft.AnalysisServices.AdomdClient.XmlaClientProvider.Microsoft.AnalysisServices.AdomdClient.AdomdConnection.IXmlaClientProviderEx.CreateSession(Boolean sendNamespaceCompatibility) +148
Microsoft.AnalysisServices.AdomdClient.AdomdConnection.ConnectToXMLA(Boolean createSession, Boolean isHTTP) +235
Microsoft.AnalysisServices.AdomdClient.AdomdConnection.Open() +973
btn_intranet.Areas.Sales.Controllers.HomeController.CumulativeChart(String month, String year) in <path to file>/HomeController.cs:52
lambda_method(Closure , ControllerBase , Object[] ) +182
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +264
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39
System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +129
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +798650
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +314
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +798704
System.Web.Mvc.Controller.ExecuteCore() +159
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +62
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +20
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +54
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +469
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375
任何帮助将不胜感激,谢谢!
Possible Duplicate:
Can I turn off impersonation just in a couple instances
I've created an application that, when uploaded to my server throws an exception. It works fine locally but the moment I upload it to my server I get the following error:
System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
Here is my connection string:
AdomdConnection conn = new AdomdConnection("Data Source=BTN-SQL1;Initial Catalog=BTNTurboAnalysisServices;");
Its worth noting that BTN-SQL1 is on a different server to my web server, could that be causing a problem? I'm also using Windows Authentication.
Below is my stack trace:
[SocketException (0x2746): An existing connection was forcibly closed by the remote host]
System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +245
[IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.]
System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +7856541
System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count) +253
Microsoft.AnalysisServices.AdomdClient.DimeRecord.ForceRead(Stream stream, Byte[] buffer, Int32 length) +61
Microsoft.AnalysisServices.AdomdClient.DimeRecord.ReadHeader() +53
Microsoft.AnalysisServices.AdomdClient.DimeReader.ReadRecord() +112
Microsoft.AnalysisServices.AdomdClient.TcpStream.GetResponseDataType() +120
[AdomdConnectionException: The connection either timed out or was lost.]
Microsoft.AnalysisServices.AdomdClient.XmlaClient.EndRequest() +1367
Microsoft.AnalysisServices.AdomdClient.XmlaClient.CreateSession(ListDictionary properties, Boolean sendNamespaceCompatibility) +387
Microsoft.AnalysisServices.AdomdClient.XmlaClientProvider.Microsoft.AnalysisServices.AdomdClient.AdomdConnection.IXmlaClientProviderEx.CreateSession(Boolean sendNamespaceCompatibility) +148
Microsoft.AnalysisServices.AdomdClient.AdomdConnection.ConnectToXMLA(Boolean createSession, Boolean isHTTP) +235
Microsoft.AnalysisServices.AdomdClient.AdomdConnection.Open() +973
btn_intranet.Areas.Sales.Controllers.HomeController.CumulativeChart(String month, String year) in <path to file>/HomeController.cs:52
lambda_method(Closure , ControllerBase , Object[] ) +182
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +264
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39
System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +129
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +798650
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +314
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +798704
System.Web.Mvc.Controller.ExecuteCore() +159
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +62
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +20
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +54
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +469
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375
Any help would be appreciated, thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
看起来您是通过 MVC 访问的,那么您的 IIS 应用程序池身份是否有权访问 SSAS 实例?您可能需要创建一个 Windows(最好是域)帐户,并让应用程序池在该帐户下运行,并授予其访问 SSAS 的权限。
It looks like you're accessing via MVC, so does your IIS application pool identity have permissions to access the SSAS instance? You may need to create a windows (Ideally domain) account, and get the application pool to run under that, giving it permissions to access SSAS.
我建议验证 SQL Server 计算机上的防火墙不会阻止您的请求。
I would recommend verifying that the firewall on the SQL Server machine doesn't block your request.
我已经成功解决了这个问题。基本上,我只是通过使用此处找到的解决方案禁用了导致问题的特定方法的模拟:
我可以仅在几个实例中关闭模拟
I've managed to solve the problem. Basically I just disabled impersonation for the specific methods that were causing the problem by using the solution found here:
Can I turn off impersonation just in a couple instances