在局域网中使用c#windows应用程序 [英] using c#windows application in lan

查看:75
本文介绍了在局域网中使用c#windows应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在局域网中共享了Windows应用程序的文件夹,并在不同的机器上运行调试中的.exe文件。我在本地计算机上访问数据库,但是我无法访问SQL Server 2008数据库到本地计算机以外的计算机。我想解决方案

I have shared folder of windows application in LAN and run the .exe file in debug on different machines. I get the access of database on local machine but I cant get access of SQL server 2008 database to machines other than local machine. I want solution

推荐答案

这取决于许多可能的因素。

从你的连接字符串开始:它需要指定主机PC名称和SQL实例,或主机IP地址和SQL实例,而不是localhost,它将始终引用运行该应用程序的当前PC。将它保存在配置文件中是一个非常好的主意,因此可以在不编辑应用程序的情况下进行更改。

它还应该指定用户名和密码(而不是SA用户)而不是依赖于Windows身份验证。



如果这是正确的,那么请开始查看防火墙,并确保您连接的SQL实例配置为允许远程连接。



我们可以为您做任何事情:它需要访问您的应用程序,您的SQL实例,物理机器以及它们所连接的网络 - 我们不会你有,你做...
That's down to a number of possible factors.
Start with your connection string: it needs to specify the host PC name and SQL instance, or the host IP address and the SQL instance, not "localhost" which will always refer to the current PC the app is running on. It's a very good idea to hold this in a configuration file so it can be changed without editing your application.
It should also specify a user name and password (but not the SA user) rather than rely on windows authentication.

If that's right then start looking at firewalls, and make sure that the SQL instance you are connecting to is configured to allow remote connections.

We can;t do any of that for you: it requires access to your app, your SQL instance, the physical machines, and teh network they are connected to - which we don't have, and you do...


这篇关于在局域网中使用c#windows应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆