简体   繁体   English

使用 C# 访问树莓派 Web 服务器

[英]Accessing Raspberry Pi Webserver with C#

I am looking for a way to connect a database to my WPF Application.我正在寻找一种将数据库连接到我的 WPF 应用程序的方法。 I already connected it to a database which is installed on the same machine, but now I want my program to run on other computers as well, that means I need a server which I can access remotely.我已经将它连接到安装在同一台计算机上的数据库,但现在我希望我的程序也可以在其他计算机上运行,这意味着我需要一个可以远程访问的服务器。 So I came across using a Raspberry Pi as WebService with an MySQL database and accessing this database with a Rest API.所以我遇到了使用 Raspberry Pi 作为 WebService 和 MySQL 数据库并使用 Rest API 访问该数据库。 As I am quite new to these kind of problems (servers) I wanted to ask if anyone has experience with using a Raspberry Pi as Webserver and could give me some suggestions or tutorial recommendations.由于我对这类问题(服务器)很陌生,所以我想问一下是否有人有使用 Raspberry Pi 作为 Web 服务器的经验,可以给我一些建议或教程推荐。

Thanks in advance!提前致谢!

If you have a MYSQL instance running on a Raspberry Pi you don't need a WebService to connect to it.如果您在 Raspberry Pi 上运行 MYSQL 实例,则不需要 WebService 来连接它。 You need to set up the MySQL database and then you can connect via the appropriate connection string as long as you are on the same network as the Pi.您需要设置 MySQL 数据库,然后只要您与 Pi 在同一网络上,就可以通过适当的连接字符串进行连接。 I don't know what OR mapper you are using in your WPF application.我不知道您在 WPF 应用程序中使用的是什么 OR 映射器。 But here is a guide to set up a MySQL database on a Pi and make it available on the network.但这里是在 Pi 上设置 MySQL 数据库并使其在网络上可用的指南。

https://howtoraspberrypi.com/enable-mysql-remote-connection-raspberry-pi/ https://howtoraspberrypi.com/enable-mysql-remote-connection-raspberry-pi/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM