[英]Add C# project to a web site using IIS 6.0
I just finished my first C# project in VS 2008 and it is working well now. 我刚刚在VS 2008中完成了我的第一个C#项目,现在运行良好。 But now I need to publish this project on my new website.
但是现在我需要将该项目发布到我的新网站上。 This project interacts with my SQL Server 2008 Adventureworks database on this same computer.
该项目与我在同一台计算机上的SQL Server 2008 Adventureworks数据库进行交互。 I am running IIS 6.0, but I am a newbie to both IIS 6.0 and VS 2008.
我正在运行IIS 6.0,但我还是IIS 6.0和VS 2008的新手。
I will use this same computer to host the website and house this database. 我将使用同一台计算机来托管网站并容纳该数据库。 I know HTML but not how to add a .NET project to a web site, especially one that also uses SQL Server.
我知道HTML,但不知道如何将.NET项目添加到网站,尤其是还使用SQL Server的网站。 Can u offer me tips as to how to proceed?
您能给我提示如何进行吗? This is not a Windows Form Application, so I am pretty sure it is a Web Application.
这不是Windows窗体应用程序,所以我很确定它是Web应用程序。
I started by right-clicking the project and selecting "Convert to Web Application" and then I selected the URL for my site. 首先,右键单击该项目,然后选择“转换为Web应用程序”,然后选择站点的URL。 But then when I went to this URL, it still shows the original image.
但是当我转到该URL时,它仍然显示原始图像。
Next I opened the IIS console window (Admin tool), but I didn't see an option to add a new website, so instead I opened the Properties window for Default website. 接下来,我打开了IIS控制台窗口(管理工具),但是没有看到添加新网站的选项,所以我打开了“默认网站”的“属性”窗口。 But even after changing the home directory here both to point to my project directory and also to point to my desired URL, when I refreshed my web browser it still shows same webpage from this URL.
但是,即使在这里更改了主目录后,它们既指向我的项目目录,又指向我想要的URL,但是当我刷新Web浏览器时,它仍然显示来自该URL的相同网页。 Do I have to close and reopen my web browser?
我必须关闭并重新打开网络浏览器吗? There are so many tabs and options in this IIS console window.
此IIS控制台窗口中有许多选项卡和选项。 Can you give me step-by-step instructions of what to choose?
您可以逐步告诉我如何选择吗? I also see many Property options in VS 2008 for this project.
我在VS 2008中也看到了该项目的许多Property选项。 Maybe I need to change something there?
也许我需要在那改变一些东西?
Did you create this C# project by using "New Web Site" or "New Project"? 您是否使用“新网站”或“新项目”创建了此C#项目?
If this is a web site, then when you right-click the "project", you'll see a "Publish Web Site" command. 如果这是一个网站,则在“项目”上单击鼠标右键时,您将看到“发布网站”命令。 Try that.
试试看
That's all there is to it. 这里的所有都是它的。
I'd recommend starting by setting the application up on the default site (localhost) and testing it there. 我建议首先在默认站点(本地主机)上设置应用程序并在其中进行测试。
To do this, 去做这个,
(Edited to work on IIS 6) (经编辑可在IIS 6上使用)
(above assumes you already have the .net framework installed) (以上假设您已经安装了.net框架)
The process for setting up a public website is similar, but you choose "New -> Web Site" from the "Web Sites" folder in step 3, and the interface that pops up will request a host header too. 设置公共网站的过程类似,但是在步骤3中,从“网站”文件夹中选择“新建->网站”,弹出的界面也会请求主机头。 For info on host headers, dns, etc. you should look on serverfault.com.
有关主机头,dns等的信息,请查看serverfault.com。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.