如何在其他 PC 上发布 VB.net 应用程序,因为我的 PC 使用 sql 服务器成为服务器主机

how to publish VB.net Application at other PC as my PC become server host using sql server

我对 VB.NET 或 Visual Studio 应用有一些疑问。好吧,让我从应用程序开始……我完全完成了构建一个应用程序的工作,该应用程序将使用 SQL Server Management Studio 为我的应用程序存储、编辑、导入和其他内容,我的 PC 是服务器的主机应用程序...我在我的电脑上发布的应用程序工作正常并且没有发生错误..但是当我将发布的文件复制到其他电脑并安装该应用程序时..错误发生是因为它无法连接到我的服务器.. 我如何正确发布以便我可以为其他电脑安装应用程序

Dim conn As New SqlConnection("Server=MYA02W00018;Database=PHMTest;Integrated Security = True")

这是连接字符串

对不起,我应该先把这个错误发回去

回答:我的错是因为在我加入域后另一台电脑没有加入域发生错误,来自不受信任域的登录 ID 不能与集成身份验证一起使用..然后我只是将服务器身份验证更改为SQL 和 windows 在 SQL 服务器管理中进行身份验证,然后 Integrated Security = True 我只需要将其删除..知道我已经登录了谢谢大家的帮助

打开您的应用程序的安装位置。您会找到一个与您的应用共享名称的文件,例如如果您的应用程序名称是 biz_monitor,文件将被命名为 biz_monitor.exe.config,如附图

所示

使用记事本等文本编辑器打开该文件。 找到这些行:

  connectionStrings>
            <add name="Biz_monitor.My.MySettings.constring" connectionString="server=myserver_ip;user id=my_username;password=mypassword;database=mydatabase;procedure cache size=50;use performance monitor=True;use usage advisor=True;logging=True;connection reset=True"
                providerName="MySql.Data.MySqlClient" />
           
        </connectionStrings>

编辑:1. server 到托管 sql 服务器的机器的 ip 地址,2. database 到名称你的数据库, 3.user id to your user name 4. Password to password of your sql server

然后确保没有防火墙或防病毒软件阻止您的连接。测试并提供反馈

  1. 使用它的 IP 地址 ping 服务器。如果您还没有分配静态 ip,请分配静态 ip。如果 ping 有效,则建立网络连接,如果不能,请先修复网络。 然后像这样构造您的连接字符串: Connstring = "Data Source=" & Server & ";Initial Catalog=" & DbName & ";User ID=" & 用户 & ";密码=" & 密码 & ""

配置您的 SQL 服务器以使用 'SQL Server Authentication'

现在我已经得到答案了Integrated Security = True我只需要删除它..知道我已经登录了谢谢大家的帮助