我正在尝试POST到我的ServiceStack服务并从我的CREATED实体的响应中检索Location头.我不确定使用IReturn是否有效,但我不确定如何从我的客户端访问响应头.有人可以帮我理解如何正确地与HttpResult交互吗?代码底部有一个测试用例来演示我想要做的事情.这是codz:
public class ServiceStackSpike
{
public class AppHost : AppHostHttpListenerBase
{
public AppHost() : base("TODOs Tests", typeof(Todo).Assembly) { }
public override void Configure(Container container)
{
//noop
}
}
[Route("/todos", "POST")]
public class Todo:IReturn<HttpResult>
{
public long Id { get; set; }
public string Content { get; set; }
public int Order { get; set; }
public bool Done { get; set; }
}
public class TodosService : Service
{
public object Post(Todo todo)
{
//do stuff here
var result = …
Run Code Online (Sandbox Code Playgroud) 我试图在MSDeploy命令的preSync调用期间调用powershell,但powershell在调用之后不会退出该进程.该命令(来自命令行):"tools/MSDeploy/msdeploy.exe"-verb:sync -preSync:runCommand ="powershell.exe -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command C:/MyInstallPath/deploy.ps1 Set -WebAppOffline Uninstall-Service",waitInterval = 60000 -usechecksum -source:dirPath ="build/for-deployment"-dest:wmsvc = BLUEPRINT-X86,username = deployer,password = deployer,dirPath = C:/ MyInstallPath
我在这里使用了一个hack(http://therightstuff.de/2010/02/06/How-We-Practice-Continuous-Integration-And-Deployment-With-MSDeploy.aspx)来获取powershell进程并将其杀死但是没用.我也尝试过taskkill和sysinternals等效,但没有任何东西可以杀死进程,以免MSDeploy出错.该命令已执行,但随后就在那里.什么可能导致powershell像这样挂起的想法?我在网络上发现了一些其他类似的问题,但没有答案.
环境是Win 2K3,使用Powershell 2.0.
更新:这是我用来调用我的powershell命令的.vbs脚本.使用'cscript.exe path/to/script.vbs'调用:
Option Explicit
Dim oShell, appCmd,oShellExec
Set oShell = CreateObject("WScript.Shell")
appCmd = "powershell.exe -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ""&{ . c:/development/materialstesting/deploy/web/deploy.ps1; Set-WebAppOffline }"" "
Set oShellExec = oShell.Exec(appCmd)
oShellExec.StdIn.Close()
Run Code Online (Sandbox Code Playgroud)