asp.net-mvc 如何使用 bin 文件夹在 IIS 上部署 ASP.Net MVC 4 应用程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20878263/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to deploy ASP.Net MVC 4 application on IIS with bin folder
提问by Shahbaz Ahmad
I have tried these steps but could not make it. When I browse my app it shows dll file.
我已经尝试过这些步骤,但无法完成。当我浏览我的应用程序时,它会显示 dll 文件。
- Log onto the machine that is or will be hosting your application.
- Use IIS Manager to create a new website for your application.
- Create a new application in that site. I believe this also will automatically create an application pool with the same name for you and use it by default.
- Specify the
virtual directoryfor your application. This is going to tell IIS where to look for your mvc application. For this case lets assume it isC:\myApp - On your own machine
Build the applicationhowever you build it with the correct solution configuration (i.e.Releasemode). Lets say the result of your build is located atC:\MyProject\bin. - Copy
C:\MyProject\binfrom your machine onto your hosting machine atC:\myApp
- 登录正在或将要托管您的应用程序的计算机。
- 使用 IIS 管理器为您的应用程序创建一个新网站。
- 在该站点中创建一个新应用程序。我相信这也会自动为您创建一个同名的应用程序池并默认使用它。
virtual directory为您的应用程序指定。这将告诉 IIS 在哪里查找您的 mvc 应用程序。对于这种情况,我们假设它是C:\myAppBuild the application但是,在您自己的机器上,您可以使用正确的解决方案配置(即Release模式)构建它。假设您的构建结果位于C:\MyProject\bin.C:\MyProject\bin从您的机器复制到您的托管机器上C:\myApp
I am a novice to this technology.
我是这项技术的新手。
回答by Ahmed ilyas
you shouldn't just drag the bin folder. it is everything else too like the images, css, jscript files as well as the cshtml files too (your views) to the c:\myapp folder.
你不应该只是拖动 bin 文件夹。它也是其他所有内容,例如图像、css、jscript 文件以及 cshtml 文件(您的视图)到 c:\myapp 文件夹。
or perhaps just do a publish within visual studio. maybe even take a look at this to see if this helps:
或者只是在 Visual Studio 中发布。甚至可以看看这个,看看这是否有帮助:
How to publish my MVC 3 web application onto IIS7
but generally speaking, I build the solution. I then create the vdir in my IIS. I copy the bin and view folder along with images/css/jscript/shared folders etc... to C:\my deployed site. I then convert to application for that vdir I just created in IIS.
但总的来说,我构建了解决方案。然后我在我的 IIS 中创建 vdir。我将 bin 和 view 文件夹与图像/css/jscript/共享文件夹等一起复制到 C:\我部署的站点。然后我转换为我刚刚在 IIS 中创建的那个 vdir 的应用程序。
回答by Menotaurus
You have to use publishaction for ASP.Net web application(MVC, Forms and etc.)
您必须对 ASP.Net Web 应用程序(MVC、表单等)使用发布操作

