简体   繁体   English

ASP.NET与VS 2010:网站还是Web应用程序?

[英]ASP.NET with VS 2010: Web Site or Web Application?

When I start a new ASP.NET project in Visual Studio 2010, I can either create a new ASP.NET Web Site or an ASP.NET Web Application. 当我在Visual Studio 2010中启动一个新的ASP.NET项目时,我可以创建一个新的ASP.NET网站或一个ASP.NET Web应用程序。

What's the difference between these two project types? 这两种项目类型有什么区别? Why would I choose one over the other? 为什么我会选择一个而不是另一个?

Please note : this question is an exact duplicate of this one , but I'm asking specifically about Visual Studio 2010 (there are no answers targeted at VS 2010 in the original question). 请注意 :这个问题是一个确切的重复这一个 ,但我专门询问有关Visual Studio 2010(有没有在原来的问题,在VS 2010中有针对性的答案)。 So are the answers of the other question still valid or are there any changes with VS2010 which results in different answers? 那么另一个问题的答案是否仍然有效,或者VS2010是否有任何变化导致不同的答案?

I just want to give an example that website means its a site by which we can get some information. 我只是想举一个例子,网站意味着它是一个我们可以获得一些信息的网站。 they will be a collection of websites in a Web Application. 它们将是Web应用程序中的网站集合。 Example take any company site. 示例采取任何公司站点。 And coming to web Application the best example is Gmail. 进入网络应用程序最好的例子是Gmail。 which is an application . 这是一个应用程序。 which we use. 我们用的。 This is the general difference between these two. 这是这两者之间的一般差异。 Even it may also contain a collection of websites. 甚至它也可能包含一系列网站。 But depending on the Requirement. 但取决于要求。

I know this question is a bit old, but just in case someone finds it.. I believe that if you want to use Web.config Transformations (useful if you want to have different setting's for development and release) then you need to be using a web application. 我知道这个问题有点旧,但万一有人发现它..我相信如果你想使用Web.config 转换 (如果你想要开发和发布不同的设置很有用)那么你需要使用一个Web应用程序。

Technically this is probably a result of the same differences as in 2008 between a web site project or a web application project, but being that it's a new feature in vs 2010 (at least built in, i think you can get it in vs 2008 also ) it's at least one new difference from vs 2008 to vs 2010 to consider when choosing which way to go. 从技术上讲,这可能是因为网站项目或Web应用程序项目与2008年相同的差异,但是它是vs 2010中的新功能(至少内置,我认为你可以在vs 2008中获得它)在选择哪条路时,至少要考虑从2008年到2010年的新差异。

I would recommend website only for a very simple/small application. 我建议网站仅用于非常简单/小型的应用程序。 Build times are higher, you cannot use nuget, there are no namespaces (although aspx and ascx class names can be pretty cool), no conditional compilation symbols, no immediate code tests (since there's no a single .dll to be referenced), etc. 构建时间更长,你不能使用nuget,没有命名空间(虽然aspx和ascx类名称可以很酷),没有条件编译符号,没有立即代码测试(因为没有单个.dll被引用),等等。

In more complex scenarios the way to go is web application. 在更复杂的场景中,方法是Web应用程序。

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

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