Reputation: 30175
I'd like clarification of what seems to be a contradiction in MSDN documentation.
MSDN makes very clear the distinction between a "web site" and a "web application." For example, it says you should use an "application" instead of a "site" if...
You want to avoid putting source code on a production server.
Ok, sounds good, but when you create an ASP.NET MVC "app" or a WCF service "app", the first thing you get is a description file with a CodeBehind
that specifies what source code to reference. Examples:
<%@ Application Codebehind="Global.asax.cs" Language="C#" Inherits="Sample.MvcApplication" %>
<%@ ServiceHost CodeBehind="MyService.svc.cs" Language="C#" Service="Sample.MyService" %>
In both these "app" examples, the "CodeBehind" assumes you have placed source code on your production server. In short, what you receive from a Visual Studio "App" or "project" template basically contradicts the claim made by MSDN documentation.
What makes this more strange is that, at least in some caes, this doesn't need to be this way. For example, another valid way for the WCF service description file to be generated is like this:
<%@ ServiceHost Language="C#" Debug="true" Service="Sample.AccountService" %>
<%@ Assembly Name="Sample.AccountService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" %>
With the "Assembly" directive, it is not necessary to specify a CodeBehind target. If a purpose of a WCF app (in contrast with a WCF site, which is also a Visual Studio option) is to have no source code on a production server, why then is the service definition file not generated as shown in the last sample above?
What is the rationale that allows this apparent contradiction?
Upvotes: 1
Views: 355
Reputation: 18162
You want to avoid putting source code on a production server.
This is referring to the ability use non-compiled code. With a website, you have the ability to copy your aspx.cs or aspx.vb files (in clear text) along the aspx files and have them run. You can also modify them in clear text because they are not compiled.
A web application differs because must be compiled, the source code exists in DLLs.
Upvotes: 2