问题描述
我们有一个非常简单的asp.net项目,该项目由以下内容组成:Home.aspx,web.config和 Home.aspx 使用的一些图像.该Web表单还连接到sql服务器数据库.
We have a very simple asp.net project that's composed of the following: Home.aspx, web.config, and a few images that Home.aspx uses. This webform also connects to a sql server database.
因此,假设某个客户购买了我们的网站应用程序.因此,我们去他们的办公室,首先将SQL Server数据库安装在他们网络内的服务器中.
So let's say a client purchases our website app. So we go to their offices and we first install the SQL Server database in a server within their network.
现在,这就是我要坚持的地方:创建数据库(并配置web.config)后,我们希望向客户端提供Windows应用程序(即EXE),双击该应用程序将打开具有浏览器控件的Windows窗体,该窗体将显示[Home.aspx].
Now, this is where I'm stuck: once we create the database (and configure web.config), we want to hand our client a Windows Application (ie. an EXE) that, when double-clicked, will open a Windows Form with a browser control that will display [Home.aspx].
问题是我想在Windows可执行文件中包含所有内容.此可执行文件将包括所有图像[Home.aspx],web.config.[Home.aspx]超出此Windows可执行文件的唯一原因是连接到网络中的sql server数据库.好像Windows应用程序具有托管此网站所需的一切.
The issue is that I want to include everything in this Windows executable. All images, [Home.aspx], web.config will be included in this executable. The only reason [Home.aspx] would go beyond this Windows Executable is to connect to the sql server database that's in the network. It's as if the Windows Application has everything needed to host this website.
这可能吗?
谢谢.
推荐答案
Dude唯一的方法是将ASP.NET Web应用程序设置为主机服务器上的Web API或将其设置为本地主机上的API.因此,如果尝试在客户端计算机上执行此操作,则需要在该计算机上安装IIS.这是有关如何在Windows窗体应用程序中运行ASP.NET Web API的完整指南.所以你要做的是
Dude the Only way of doing this is either making your ASP.NET Web application a web API on a host server or making it an API on Local Host. So if you are trying to do it on client's Machine you will be needing IIS Installed over that machine. Here is a Complete Guide that how you can Run ASP.NET Web API in your Windows form application. So what you have to do is
1:制作您的ASP.NET Web API
1: Make your ASP.NET Web API
2:制作Windows窗体应用程序
2: Make your Windows Form Application
3:从Windows窗体应用程序中调用该API
3: Call that API from your Windows Form Application
4:尽情享受
欢呼
这篇关于在Windows窗体应用程序中运行ASP.NET项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!