所有ASP.NET MVC 4 RC程序集对于ASP.NET WebAPI RC部署来说都是必要的吗? [英] Are all of the ASP.NET MVC 4 RC assemblies really necessary for a ASP.NET WebAPI RC deployment?

查看:167
本文介绍了所有ASP.NET MVC 4 RC程序集对于ASP.NET WebAPI RC部署来说都是必要的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在Visual Studio 2010中创建一个空WebAPI项目时,支持MVC网页的几个新程序集被添加为引用(下面的列表中的几个例子):

When I created a "Empty WebAPI" project in Visual Studio 2010, several of the new assemblies to support the MVC web pages were added as references (an example of the few in the list below):


  • System.Web.Razor.dll

  • System.Web.WebPages.Deployment.dll

  • System.Web.WebPages.dll

  • System.Web.WebPages.Razor.dll

  • System.Web.Razor.dll
  • System.Web.WebPages.Deployment.dll
  • System.Web.WebPages.dll
  • System.Web.WebPages.Razor.dll

为了清洁起见,我删除了我没有使用的DLL引用(或者我以为我不是使用)。当部署到服务器时,我会收到以下异常:

For the sake of cleanliness, I removed those DLL references that I wasn't using (or so I thought I wasn't "using"). When deploying to the server I would get exceptions like the following:


Exception message: Could not load file or assembly 'System.Web.Razor,Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.


我正在做一个bin部署到服务器,全部在JIT复制错误停止之前,这些程序集已经消失。

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

我了解FileNotFoundException。我知道运行时正试图解决这个问题。

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

我的问题
为什么要携带当您尝试创建的所有MVC Razor程序集都是一个WebAPI站点?还有另一个依赖关系需要删除?

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.

我总是喜欢从 scratch 构建我的Web API项目。我不使用模板。我只需创建一个空的ASP.NET项目,并添加 Microsoft.AspNet.WebApi NuGet软件包

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部署来说都是必要的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆