ASP.NET的Web API:项目需要SQL Server防爆preSS [英] ASP.NET Web Api: Project requires SQL Server Express
问题描述
我在VS 2010下创建了一个Web API项目。
之后,我切换到VS 2012年,我总是得到一个警告:
I created a Web API project under VS 2010. After I switched to VS 2012, I always get a warning:
Web项目'XXX'需要SQL Server防爆preSS,whcih不
此计算机上安装。 [...]
The Web project 'xxx' requires SQL Server Express, whcih is not installed on this computer. [...]
我不希望安装此SQL Server防爆preSS。我使用IIS进行调试。
如何禁用这种依赖?
I do not want to install this SQL Server Express. I use IIS for debugging. How can I disable this dependency?
我也注意到这在我的web.config:
I noticed also this in my web.config:
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|[...].mdf;Initial Catalog=[...];Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
</connectionStrings>
是谁创造的?我可以删除吗?
Who created this? Can I delete this?
推荐答案
这是由Visual Studio中创建。原因是网络API项目是一个子类MVC项目。而实际上,网络API项目可以包含两种:一个Web应用程序和Web API本身
It was created by Visual Studio to you. The reason is Web API projects are a sub class of MVC projects. And actually, Web API project can contain both: a web application and Web API itself.
至于这个项目是一个子类的MVC项目你得到所有这些额外的功能。
As far as this project is a sub class of an MVC project you get all this extra features.
您可以删除所有多余的东西,只要你不需要它。您还可以删除的东西:
You can delete all that extra stuff as far as you don't need it. The things you can delete also:
在WebConfig:
- / configSections /节名称=的EntityFramework...
- /是connectionStrings
- /system.web/pages
- /system.web/profile
- /system.web/membership
- /system.web/roleManager
- /的EntityFramework
您可能也想删除
的NuGet包:
除了剃须刀一切,MVC,网络API包,如:
Everything except razor, MVC, Web Api packages like:
- 的jQuery
- 的EntityFramework
- jQuery验证
- jQuery UI的
- Modernizr的
- knockoutjs
- MS不显眼的AJAX
- MS不显眼的审定
在Solution Explorer中:
- / App_Data文件
- /内容
- /图片
- /脚本
- /浏览次数
但要谨慎,因为删除后,你将无法添加例如网页API帮助页面(描述你的API)。
But be cautious, because after that deletion you won't be able to add Web API Help page for example (which describes your API).
这篇关于ASP.NET的Web API:项目需要SQL Server防爆preSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!