是否所有的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?
问题描述
当我创建了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引用。当部署到服务器我会得到像下面这样的例外:
异常消息:无法加载文件或程序集System.Web.Razor,版本= 2.0.0.0,文化=中性公钥= 31bf3856ad364e35或它的一个依赖。该系统找不到指定的文件。
块引用>我目前在做的垃圾桶部署到服务器的所有组件花了,直到JIT compliation错误停止。
据我所知,FileNotFoundException异常。据我所知,运行时试图解决该引用。
我的问题(S):
为什么要进行围绕MVC剃刀组件时,你要创建一个网站的WebAPI?是否有需要删除另一个依赖?解决方案没有,你并不需要所有这些组件。
我总是preFER从的从头的构建我的Web API项目。我不使用的模板。我只是创建一个空的ASP.NET项目并添加 Microsoft.AspNet.WebApi 的NuGet包。
下面是似乎只需要引用:
Microsoft.CSharp
Microsoft.Web.Infrastructure // Microsoft.Web.Infrastructure的NuGet包
Newtonsoft.Json // Newtonsoft.Json的NuGet包
System.Net.Http // Microsoft.Net.Http的NuGet包
System.Net.Http.Formatting // Microsoft.AspNet.WebApi.Client的NuGet包
System.Net.Http.WebRequest // Microsoft.Net.Http的NuGet包
System.Web.DynamicData
System.Web.Entity
System.Web.ApplicationServices
System.ComponentModel.DataAnnotations
系统
System.Data这
System.Core程序
System.Data.DataSetExtensions
System.Web.Extensions程序
System.Web.Http // Microsoft.AspNet.WebApi.Core的NuGet包
System.Web.Http.WebHost // Microsoft.AspNet.WebApi.WebHost的NuGet包
System.Xml.Linq的
System.Drawing中
的System.Web
的System.Xml
系统配置
System.Web.Services
的System.EnterpriseServicesWhen 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
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.
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部署?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!