简体   繁体   中英

Using C# within IIS7

I'm very new to IIS7 and somewhat new to C#. My project right now is to use C# and IIS7 to create an interactive website with various clickable items and features. The C# programs are written and working properly, however I honestly do not know much about IIS7 despite trying to research it for a good amount of time.

My question is, how do I integrate C# scripts into ISS7 so that the website can be hosted with said scripts running smoothly within it? In other words, how do I combine the powers of ISS7 and my C# code to make a website? What must I do within ISS7 to utilize my C# code?

I've already "created" my new site within IIS7 and given it the appropriate bindings. I'm just not sure where to go from here.

I realize this may be a broad question/answer, so pointing me to where information on this topic can be found would also be greatly appreciated. I've searched through the official IIS website without much luck. Thank you.

It depends on what kind of code you want to run. The best start might be a straight forward web project, and not web services/web api.

Create a new web site project in visual studio, and hook it up with IIS in project properties-> web -> uncheck "Use IIS Express" and click "Create Virtual Directory" . When you build the solution next time, it will be "deployed" to your local IIS.

项目属性

A virtual directory maps to a physical directory on a computer. The web application will be running on your machine. If you have IIS on a web server that is not your development machine, then you have to deploy your web application to this server. You might find this usefull: How to: Create IIS Virtual Directories in Visual Studio

The relationship between Visual Studio and IIS is that you can create virtual directories from Visual Studio. This means that when you visit localhost/MvcApplication1 , IIS serves you the web application that is mapped in C:\\Users\\<Username>\\Documents\\Visual Studio 2012\\Projects\\MvcApplication1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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