本文介绍了是否所有的ASP.NET MVC 4 RC组件确实需要一个ASP.NET的WebAPI RC部署?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我创建了Visual Studio 2010的一个空的WebAPI项目,一些新的组件,支持MVC Web页面中添加作为参考(为数不多的例子在下面的列表):


  • System.Web.Razor.dll

  • System.Web.WebPages.Deployment.dll

  • System.Web.WebPages.dll

  • System.Web.WebPages.Razor.dll

有关清洁的缘故,我删除,我没有使用(或所以我想我是不是用),这些DLL引用。当部署到服务器我会得到像下面这样的例外:

I am currently doing a bin deploy to the server with all of the assemblies it took until the JIT compliation errors ceased.

I understand the FileNotFoundException. I understand that the runtime is trying to resolve that reference.

My question(s):Why is it necessary to carry around the MVC Razor assemblies when all you are trying to create is a WebAPI site? Is there another dependency that needs to be removed?

解决方案

No, you don't need all those assemblies.

I always prefer to build my Web API projects from scratch. I don't use the templates. I simply create an empty ASP.NET Project and add the Microsoft.AspNet.WebApi NuGet package.

Here are the references that seem to only be needed:

Microsoft.CSharp
Microsoft.Web.Infrastructure   // Microsoft.Web.Infrastructure NuGet package
Newtonsoft.Json                // Newtonsoft.Json NuGet package
System.Net.Http                // Microsoft.Net.Http NuGet package
System.Net.Http.Formatting     // Microsoft.AspNet.WebApi.Client NuGet package
System.Net.Http.WebRequest     // Microsoft.Net.Http NuGet package
System.Web.DynamicData
System.Web.Entity
System.Web.ApplicationServices
System.ComponentModel.DataAnnotations
System
System.Data
System.Core
System.Data.DataSetExtensions
System.Web.Extensions
System.Web.Http                // Microsoft.AspNet.WebApi.Core NuGet package
System.Web.Http.WebHost        // Microsoft.AspNet.WebApi.WebHost NuGet package
System.Xml.Linq
System.Drawing
System.Web
System.Xml
System.Configuration
System.Web.Services
System.EnterpriseServices

这篇关于是否所有的ASP.NET MVC 4 RC组件确实需要一个ASP.NET的WebAPI RC部署?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 03:54