我用VS2005(C#)+SQL 2005在WIN2003下开发软件问题?
我用VS2005(C#)+SQL 2005在WIN2003下开发软件,我用的是WINFORM+WEBSERVICE+SQLSERVER2005的模式开发的(我将SQLSERVER2005+IIS6+WIN2003SERVER+WEBSERVICE部署在一台电脑上),局域网上只要装上WINFORM客户端,软件就可以正常使用和访问。可是我将客户端装软件装在三公里外的电脑上,想通过INTERNET进行使用和访问,结果却是无法访问和使用。
我怀疑我的客户端连接有问题,现贴出fdcclient.exe.config如下:
===============================
<?xml version= "1.0 " encoding= "utf-8 " ?>
<configuration>
<configSections>
<sectionGroup name= "applicationSettings " type= "System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 " >
<section name= "fdcclient.Properties.Settings " type= "System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 " requirePermission= "false " />
</sectionGroup>
</configSections>
<connectionStrings>
<add name= "fdcclient.Properties.Settings.ConnectionString " connectionString= "Data Source=server;Initial Catalog=fdc;Persist Security Info=True;User ID=sa;Password=txysoft; Max Pool Size =800 "
providerName= "System.Data.SqlClient " />
</connectionStrings>
<applicationSettings>
<fdcclient.Properties.Settings>
<setting name= "fdcclient_server_Service " serializeAs= "String ">
<value> http://192.168.1.101/fdcservice/Service.asmx </value>
</setting>
</fdcclient.Properties.Settings>
</applicationSettings>
<appSettings>
<add key= "RegisterId " value= "no " />
<add key= "windowstitle " value= "房地产信息管理 " />
<add key= "copyright " value= "版权: " />
<add key= "consult " value= "电话: " />
<add key= "client " value= "使用单位: " />
</appSettings>
</configuration>
=================
各位大侠,是啥原因呢?
[解决办法]
<add name= "fdcclient.Properties.Settings.ConnectionString " connectionString= "Data Source=server;Initial Catalog=fdc;Persist Security Info=True;User ID=sa;Password=txysoft; Max Pool Size =800 "
providerName= "System.Data.SqlClient " />
--------------------
Source=server ?
Internet上无法定位到你的 "Server "(命令行下输入 ping server 肯定不通嘛)
建议该成数据库服务器在Internet上的IP.(e.g 201.12.24.1),前提是你的服务器必须在Internet上有公网固定IP.
这样才能在互联网上访问到你的服务器.
[解决办法]
局域网中ip设置在外网是无法访问的,首先要确定你的iis在外网能否访问,然后确定winform中webservice设定是否正确。
一般代码不会错,主要是网络访问问题