简体   繁体   English

在Winform C#中加载asp.net网站

[英]Load asp.net website inside winform C#

I have a(n) (MDI) Windows Form application. 我有一个(MDI)Windows窗体应用程序。 It contains two forms. 它包含两种形式。 One form (Measured data) controls an engine, another form (laboratory) should show my asp.net web site that has various assignments for the user to do. 一种形式(测量数据)控制引擎,另一种形式(实验室)应显示我的asp.net网站,该网站具有用户要做的各种分配。

How can I show the asp.net default page in that laboratory form? 如何以该实验室形式显示asp.net默认页面? I'm using awesomium to make a browsing window in my laboratory form. 我正在使用Awesomium制作实验室形式的浏览窗口。

Doing the following 进行以下操作

webView.LoadURL("file:///D:/school/4e%20jaar/Erasmus/ErasmusProject/Laboratory/deault.aspx");

gives an error. 给出一个错误。 Probably because the asp.net site isn't online. 可能是因为asp.net网站不在线。 but how can I run the site so I can see the default.aspx page? 但是如何运行该站点,以便可以看到default.aspx页面?

I have on solution with three projects 我有三个项目的解决方案

ErasmusProject ErasmusProject

  • ASP.NET website ASP.NET网站
  • SIMOclasses SIMOclasses
  • SIMOForm SIMOForm

The problem is you cannot execute aspx files with file:/// path. 问题是您无法使用file:///路径执行aspx文件。 You have to execute on IIS. 您必须在IIS上执行。

So first thing you have to do setup iis if you didnt, create new web site (or use Default Web Site) to execute your aspx files, than change your link file:/// to http://localhost or something. 因此,如果没有这样做,首先要做的是设置iis,创建新网站(或使用默认网站)以执行aspx文件,而不是将链接文件:///更改为http:// localhost或其他。

The URL you've specified looks like its accessing the raw file via the file system. 您指定的URL看起来像是它通过文件系统访问原始文件。 ie file:///D:/.../default.aspx . file:///D:/.../default.aspx

(You've also misspelt 'default' in your question!) (您也已在问题中误记了“默认”!)

Can you access that URL from a browser (eg IE, Firefox, etc) and see the content you want? 您可以从浏览器(例如IE,Firefox等)访问该URL并查看所需的内容吗? I suspect you can't and that you're missing the webserver that is compiling and serving the .aspx pages. 我怀疑您不能这样做,并且您缺少正在编译和提供.aspx页的Web服务器。

您应该首先托管您的网站:

WebDev.WebServer /port:9999 /path:"C:\Projects\MyWebSite"

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

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