2017-01-09 26 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

相關問題