簡體   English   中英

具有DataService的ASP.Net 4.5:無法建立連接,因為目標計算機主動拒絕了127.0.0.1

[英]ASP.Net 4.5 with DataService: No connection could be made because the target machine actively refused it 127.0.0.1

方案:我有一個簡單的.Net解決方案,其中包含兩個項目:一個網站和一個DataService。

我都將Web.config都設置為具有與本地SQL Server實例正確(經過測試)的連接字符串。

運行(調試)應用程序后,出現錯誤:

Server Error in '/' Application.

No connection could be made because the target machine actively refused it 127.0.0.1:55883

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.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:55883

Source Error: 


Line 163:            };
Line 164:
Line 165:            var app = (from a in DbSvcContext.viewApplications
Line 166:                       select new CustomizedApplicationData {
Line 167:                           aId = a.aId,

Source File: c:\Development\mySite\mySite_Admin\mySite.Web\Admin\Applications.aspx.cs    Line: 165 

Stack Trace: 


[SocketException (0x274d): No connection could be made because the target machine actively refused it 127.0.0.1:55883]
   System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +208
   System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) +309

[WebException: Unable to connect to the remote server]
   System.Net.HttpWebRequest.GetResponse() +6594148
   System.Data.Services.Client.HttpWebRequestMessage.GetResponse() +23
   System.Data.Services.Client.WebUtil.GetResponseHelper(ODataRequestMessageWrapper request, DataServiceContext context, IAsyncResult asyncResult, Boolean handleWebException) +223
   System.Data.Services.Client.QueryResult.ExecuteQuery(DataServiceContext context) +610
   System.Data.Services.Client.DataServiceRequest.Execute(DataServiceContext context, QueryComponents queryComponents) +457
   System.Data.Services.Client.DataServiceQuery`1.Execute() +77
   System.Data.Services.Client.DataServiceQuery`1.GetEnumerator() +13
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +369
   System.Linq.Enumerable.ToList(IEnumerable`1 source) +58
   mySite.Web.Admin.Applications.GetApplications() in c:\Development\mySite\mySite_Admin\mySite.Web\Admin\Applications.aspx.cs:165
   Sceip.Web.Admin.Applications.Page_Load(Object sender, EventArgs e) in c:\Development\mySite\mySite_Admin\mySite.Web\Admin\Applications.aspx.cs:151
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +92
   System.Web.UI.Control.LoadRecursive() +54
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34009

我該如何克服? 我需要能夠調試此站點,但是除非能夠運行它,否則我是SOL。

通常,這意味着阻止此端口的連接,並且問題出在您的代碼上。 您可能有防火牆規則,或者試圖通過代理(例如Fiddler)運行它,而沒有啟動和運行代理。 最簡單的檢查方法是禁用防火牆,然后重試。 如果這不起作用,請嘗試確保您的瀏覽器出於某些奇怪的原因而未嘗試通過代理連接到localhost。 (有關如何操作的信息,請參見此線程 。)

如果以上都不適用,請嘗試netstat -anb運行netstat -anb ,以查看在分配給您的端口上是否有任何監聽。 如果什么都沒收到,請嘗試更改端口號 ,看看是否對您有用。 希望這可以幫助...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM