首先,我在Ubunut中安装mono,xsp服务器,mysql-server,mysql-client。在我的C#代码中,我使用以下连接。
const string constr = "Server=localhost;" +
"Database=test;" +
"User ID=root;" +
"Password=root;" +
"Pooling=false";
然后,我在Windows visual studio C#项目中发布该项目。然后将这些文件复制到Ubuntu /home/sea/web_host
我还将数据库导入Ubuntu,并将数据库设置为localhost。
在Ubuntu中,我运行
sea@virtual-machine:~/web_host$ xsp --port 8125
xsp4
Listening on address: 0.0.0.0
Root directory: /home/sea/web_host
Listening on port: 8125 (non-secure)
Hit Return to stop the server.
在我的浏览器中,我可以使用localhost:8125/index.aspx
看到该网页
但是,Web无法连接到数据库。我已经将数据导入到Ubuntu中的MySQL数据库中,我可以在Ubuntu MySQL工作台中查看它们。但是网络无法访问MySQL数据库。
有什么问题?