问题:我正在将TeamCity设置为ASP.NET MVC项目的构建服务器.我正在使用Powershell和psake对我们的.csproj文件运行msbuild并创建一个可部署的包.从构建服务器,我可以打开powershell,运行脚本,因为没有源代码更改,msbuild不会重新生成项目DLL文件.但是,当我从TeamCity Web界面调用完全相同的脚本时,即使没有任何更改,msbuild也会重建并重新生成DLL文件.不是它应该做的AFAIK.
我把这个问题缩小到一步.为了简单起见,我设置了我的TeamCity配置,因此它没有使用任何源代码控制,它运行一个调用我的PowerShell脚本的"powershell"构建步骤.
powershell脚本运行单个命令:
exec { &$msbuild $ProjectFile /t:Package "/p:PackageLocation=$PackageFile;OutDir=$TempPath;Configuration=$Config;SolutionDir=$BaseDir\Source\" /v:m }
Run Code Online (Sandbox Code Playgroud)
当我从powershell命令行手动调用脚本时,我看到:
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
Run Code Online (Sandbox Code Playgroud)
当我通过TeamCity调用完全相同的脚本时,我看到:
[11:11:26]: CoreCompile:
[11:11:26]: c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig ...
<SNIP>
[11:11:32]: CopyFilesToOutputDirectory:
[11:11:32]: Copying file from "obj\Demo\Website.Web.dll" to "d:\deploy\Build\package\Demo\temp\Website.Web.dll".
[11:11:32]: Website.Web -> d:\deploy\Build\package\Demo\temp\Website.Web.dll
[11:11:32]: Copying file from "obj\Demo\Website.Web.pdb" to "d:\deploy\Build\package\Demo\temp\Website.Web.pdb".
[11:11:32]: _CopyWebApplicationLegacy:
[11:11:32]: Copying Web Application Project Files for Website.Web
[11:11:32]: Copying file from "obj\Demo\Website.Web.dll" to "d:\deploy\Build\package\Demo\temp\_PublishedWebsites\Website.Web\bin\Website.Web.dll".
[11:11:32]: Copying file from …
Run Code Online (Sandbox Code Playgroud) 这是我的困境.我有一组实体,我想用它们来定义一组路线的起点.例如,我想为我的网站中的所有用户提供mydomain.com/username形式的自己的"子网站",然后挂起所有UserController操作.
这是我正在做的一个粗略的例子:
我有一个"UserController",有"Index","Profile"和"Bio"等动作方法.
public ActionResult Profile( int UserID )
{
User u = User.SingleOrDefault(u => u.UserID == UserID);
return View(u);
}
Run Code Online (Sandbox Code Playgroud)
在RegisterRoutes()方法中,我这样做:
foreach (User user in User.Find(u => u.Active == true))
{
routes.MapRoute(
"",
user.UserName + "/{action}",
new { controller="User", action="Index", UserID=user.UserID }
);
}
Run Code Online (Sandbox Code Playgroud)
这是有效的,它完全按照我的要求运行:
domain.com/[username]/Profile
domain.com/[username]/Bio
Run Code Online (Sandbox Code Playgroud)
现在是有效的工作路由,他们可以将UserID作为控制器中的方法参数,因为每个用户都有自己的路由.此外,默认路由仍然有效.好极了.
我的问题是,这是疯了吗?我正在路由表中为系统中的每个用户创建一个条目.有多少条路线太多了?如果有超过10个用户,这会杀死我的服务器吗?50?1000?
如果这是疯了,我怎么可能实现这个目标?
提前致谢.我期待着蜂巢的一些意见.