简体   繁体   English

在IIS上安装ASP.NET Web API

[英]Installing an ASP.NET web API on IIS

I have built my first ASP.NET web API in MVC, when I debug the application from Visual Studio everything works perfectly. 当我从Visual Studio调试应用程序时,我已经在MVC中构建了我的第一个ASP.NET Web API。

Now I need to get these API's on my server... 现在,我需要在服务器上获取这些API。

I have tried copying the project files to the website root which usually works for normal MVC apps with views, and I have also built the project and copies the file full of DLL's and an exe to the IIS root. 我尝试将项目文件复制到网站根目录,该目录通常适用于带有视图的普通MVC应用程序,并且我还构建了项目,并将完整的DLL和exe文件复制到IIS根目录。

Obviously, neither of these worked, anyone know what I am missing? 显然,这些都不起作用,有人知道我所缺少的吗? Perhaps something I have to do with IIS? 也许我与IIS有关?

I have now tried "publishing" the project and when I try to access the site this happens... 我现在已经尝试“发布”该项目,并且当我尝试访问该站点时会发生这种情况... 内部服务器错误

Thanks in advance! 提前致谢!

Build the application then publish it. 生成应用程序,然后发布它。 Copy the published files to a favorite IIS folder. 将发布的文件复制到收藏的IIS文件夹中。 Ensure you select the right version of ASP.NET in the server for your application in the application pool. 确保在服务器中为应用程序池中的应用程序选择正确版本的ASP.NET。

When you publish and get an error such as this it is often related to a configuration issue, or other non-supported .NET Runtime issue. 当您发布并收到诸如此类的错误时,它通常与配置问题或其他不受支持的.NET Runtime问题有关。

For best results, if you can get to the Event Viewer for the server a detailed error should appear there outlining the root cause of the issue. 为了获得最佳结果,如果可以访问服务器的事件查看器,则应在其中显示详细的错误,概述问题的根本原因。

If you don't have access to the server directly, updating the <system.webServer> section with the below should get you a detailed error. 如果您无权直接访问服务器,则使用以下内容更新<system.webServer>部分将为您提供详细的错误。

<httpErrors errorMode="Detailed" /> <httpErrors errorMode =“详细” />

Just please note DO NOT LEAVE THAT LINE IN PRODUCTION! 请注意,请勿在生产中留下那条线!

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

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