问大家一个问题呢
我写了一个简单的聊天工具
客户用的是.aspx   服务端用的是winf
在win7 和xp都可以正常运行
但是在2003就报                       由于目标机器积极拒绝,无法连接。 127.0.0.1:1520 }
我关闭了防火墙端口
我第一次编写这个
但是我不明白的是在win7和XP都不报错
为什么在2003就要报错呢报错原文
未处理 System.Net.WebException
  Message="无法连接到远程服务器"
  Source="System"
  StackTrace:
       在 System.Net.HttpWebRequest.GetRequestStream()
       在 System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
       在 PowerTalkClient.PowerTalkService.FetionInterFace.GetChatInfos(String MyUserName) 位置 D:\Powertalk3\Powertalk\PowerTalkClient\Web References\PowerTalkService\Reference.cs:行号 181
       在 PowerTalkClient.FrmMain.timer1_Tick(Object sender, EventArgs e) 位置 D:\Powertalk3\Powertalk\PowerTalkClient\FrmMain.cs:行号 191
       在 System.Windows.Forms.Timer.OnTick(EventArgs e)
       在 System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
       在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       在 System.Windows.Forms.Application.Run(Form mainForm)
       在 PowerTalkClient.Program.Main() 位置 D:\Powertalk3\Powertalk\PowerTalkClient\Program.cs:行号 19
       在 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       在 System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.Net.Sockets.SocketException
       Message="由于目标机器积极拒绝,无法连接。 127.0.0.1:1520"
       Source="System"
       ErrorCode=10061
       NativeErrorCode=10061
       StackTrace:
            在 System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
            在 System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
            在 System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
       InnerException: 

解决方案 »

  1.   

    单击“开始”,依次指向“程序”、“Microsoft SQL Server 2005”和“配置工具”,然后单击“SQL Server 外围应用配置器”。 
    在“SQL Server 2005 外围应用配置器”页上,单击“服务和连接的外围应用配置器”。 
    在“服务和连接的外围应用配置器”页上,展开“数据库引擎”,依次单击“远程连接”和“本地连接和远程连接”,单击适用于您的环境的相应协议,然后单击“应用”。注意:请在接收到以下消息时单击“确定”: 
    直到重新启动数据库引擎服务后,对连接设置所做的更改才会生效。
    在“服务和连接的外围应用配置器”页上,展开“数据库引擎”,依次单击“服务”和“停止”,等待 MSSQLSERVER 服务停止,然后单击“启动”以重新启动 MSSQLSERVER 服务。