已有56人关注
《C#项目开发案例全程实录》第2版,第六章企业QQ系统
发表在C#图书答疑 2012-04-27
是否精华
版块置顶:
运行MyQQClient.sln并调试,出现提示框说“未处理NullReferenceException,未将对象引用设置到对象的实例”,运行MyQQServer.exe也出现了类似提示,运行不了。数据库已经附加过。请问这是怎么回事
分享到:
精彩评论 3
小科_mrkj
学分:43 LV2
2012-05-04
沙发
读者朋友:
    您好,首先修改一下类库中的IP地址,并重新生成类库;然后分别在服务器端和客户端重新引用该类库,并重新生成;最后,启动服务器,并打开服务之后,再启动客户端。
704358025
学分:0 LV1
TA的每日心情
奋斗
2021-02-03 09:11:25
2012-06-03
板凳
[FIELDSET][LEGEND]引自:1楼[/LEGEND]
读者朋友:
    您好,首先修改一下类库中的IP地址,并重新生成类库;然后分别在服务器端和客户端重新引用该类库,并重新生成;最后,启动服务器,并打开服务之后,再启动客户端。
[/FIELDSET]

回复:
  我也遇到同样的问题,异常如下:

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
   at MyQQServer.F_Server.UpdateUser() in E:\work\dot_net\c_sharp\project\MyQQ\MyQQServer\MyQQServer\F_Server.cs:line 227
   at MyQQServer.F_Server.Form1_Load(Object sender, EventArgs e) in E:\work\dot_net\c_sharp\project\MyQQ\MyQQServer\MyQQServer\F_Server.cs:line 214
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4971 (win7RTMGDR.050727-4900)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
----------------------------------------
MyQQServer
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///E:/work/dot_net/c_sharp/project/MyQQ/MyQQServer/MyQQServer/bin/Debug/MyQQServer.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4977 (win7RTMGDR.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4971 (win7RTMGDR.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4974 (win7RTMGDR.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
QQClass
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///E:/work/dot_net/c_sharp/project/MyQQ/MyQQServer/MyQQServer/bin/Debug/QQClass.DLL
----------------------------------------
System.Data
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_64/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Transactions
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_64/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_64/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.


请问具体要怎么解决啊?
小科_mrkj
学分:43 LV2
2012-06-06
地板
读者朋友:
您好,首先确保F_Server窗体、(F_Client\F_Logon\F_SerSetup窗体)、F_Chat窗体这3者之间,它们用到的UDPSocket组件的端口号不同。然后看一下你的SQL Server服务器名是否是((local)或者.),如果你的机器联网并且本地IP地址是127.0.0.1,则不用修改;如果不是,则需要修改ClassOptionData组件中的数据库连接字符串;最后重新生成类库,并分别在服务器端和客户端调用。
首页上一页 1 下一页尾页 3 条记录 1/1页
手机同步功能介绍
友情提示:以下图书配套资源能够实现手机同步功能
明日微信公众号
明日之星 明日之星编程特训营
客服热线(每日9:00-17:00)
400 675 1066
mingrisoft@mingrisoft.com
吉林省明日科技有限公司Copyright ©2007-2022,mingrisoft.com, All Rights Reserved长春市北湖科技开发区盛北大街3333号长春北湖科技园项目一期A10号楼四、五层
吉ICP备10002740号-2吉公网安备22010202000132经营性网站备案信息 营业执照