2017-01-09 65 views
1

我正在成功使用WebForms报表查看器控件,所以我有点惊讶地发现试图做同样的事情在的WinForm报表查看器控制失败...Microsoft.Reporting.WinForms报告查看器控制错误试图通过其访问权限禁止访问套接字

我发现了一个Sytem.Net.WebException“无法连接到远程服务器”例外的System.Net.Sockets.SocketException试图通过其访问权限(ip_address):80“以禁止的方式访问套接字。 (其中“(IP地址)”是我想要使用的地址。)

的插座例外谷歌搜索往往降落在堆叠交换的问题,其结果包括像:

  • 防火墙拦截
  • 必须以管理员身份运行(做一些事情插座)

(从结果如an attempt was made to access a socket in a way forbbiden by it's access permissions. why?

这给了我 线索。特别是,我在防火墙阻塞的概念有趣。我想知道的是,SSRS报表查看器控件或底层SOAP层是否实际上试图将我的请求从HTTP/port-80重定向到HTTPS/port-443?

我确定当我在浏览器中尝试时,端口443/HTTPS没有打到我的网站。我正在从一个网络到另一个网络,并且我猜测该端口在该级别处于关闭状态,但无论如何,我非常确定SSRS报告服务器未配置为SSL/HTTPS。

我想再次声明我可以成功地使用Web窗体报表查看器控件来访问和显示报表。

只有Windows报告查看器控件显示此问题。这是来自堆栈跟踪的几件事,让我怀疑原因是尝试使用SSL而不是我给它使用的。注意关于SetConnectionSSLFor方法和类似的部分。

System.Net.WebException was unhandled 
    HResult=-2146233079 
    Message=Unable to connect to the remote server 
    Source=Microsoft.ReportViewer.WinForms 
    StackTrace: 
     at Microsoft.Reporting.WinForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.GetSecureMethods() 
     at Microsoft.Reporting.WinForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.IsSecureMethod(String methodname) 
     at Microsoft.Reporting.WinForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.SetConnectionSSLForMethod(String methodname) 
     at Microsoft.Reporting.WinForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.ProxyMethodInvocation.Execute[TReturn](RSExecutionConnection connection, ProxyMethod`1 initialMethod, ProxyMethod`1 retryMethod) 
     at Microsoft.Reporting.WinForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.LoadReport(String Report, String HistoryID) 
     at Microsoft.Reporting.WinForms.SoapReportExecutionService.LoadReport(String report, String historyId) 
     at Microsoft.Reporting.WinForms.ServerReport.EnsureExecutionSession() 
     at Microsoft.Reporting.WinForms.ServerReport.GetParameters() 
     at ScheduleRunner.ReportHelper.GetParameters(String reportServerUrl, String reportPath) in C:\VS\Projects\Web\ScheduleRunner\ReportHelper.cs:line 27 
     at ScheduleRunner.ScheduleRunner.Start() in C:\VS\Projects\Web\ScheduleRunner\ScheduleRunner.cs:line 75 
     at ScheduleRunner.Program.Main(String[] args) in C:\VS\Projects\Web\ScheduleRunner\Program.cs:line 14 
     at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) 
     at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) 
     at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() 
     at System.Threading.ThreadHelper.ThreadStart_Context(Object state) 
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
     at System.Threading.ThreadHelper.ThreadStart() 
    InnerException: 
     ErrorCode=10013 
     HResult=-2147467259 
     Message=An attempt was made to access a socket in a way forbidden by its access permissions (ip_address):80 
     NativeErrorCode=10013 
     Source=System 
     StackTrace: 
      at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) 
      at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) 
     InnerException: 

如果这确实是强制SSL,那我该如何防范呢?我正在使用HTTP,并且仅使用查看器本身,soap层就显得不受我的控制。

所有我想要做的只是得到报表参数,特别是看看他们的默认,因为这些可能含有被计算并通过过表达改变。

我当时真的打算将这些作为调用基于URL的访问模式来获取导出报告的一部分。

关于另一个话题,我可能还需要检查报告是否具有某些隐藏参数,因为我可能想要提供它们,但前提是它们存在。但是我还没有这个部分,因为我无法连接winforms查看器,即使Web表单查看器连接正常,都可以从我的机器本地运行以进行开发。

更新2017/1/10我开始注意到更简单的代码的其他问题。例如,它似乎是无法使用webclient连接到任何东西...

回答

0

我简化了我的尝试,发现即使是一个非常简单的webclient请求也失败了相同的错误。

经过大量的故障排除后,我开始想知道我可以关闭或卸载什么以简化我的问题。防病毒对于问题来说总是一个不错的目标。

我确实发现查杀Kaperski确实解决了我的问题,即使它没有运行防火墙或其他各种组件。即使运行Windows 10,Visual Studio 2015和Kaperski的其他开发人员似乎也没有遇到同样的问题。

+0

对于任何可能担心的人来说,这不是一个防火墙,也不需要以管理员权限运行。 – Greg