在此msdn站点上,我找到了如何使用构建asp.net5应用程序并将其部署到Azure的指南。第一步是使用以下powershell预构建脚本安装dnx
# bootstrap DNVM into this session.
&{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}
# load up the global.json so we can find the DNX version
$globalJson = Get-Content -Path $PSScriptRoot\global.json -Raw -ErrorAction Ignore | ConvertFrom-Json -ErrorAction Ignore
if($globalJson)
{
$dnxVersion = $globalJson.sdk.version
}
else
{
Write-Warning "Unable to locate global.json to determine using 'latest'"
$dnxVersion = "latest"
}
# install DNX
# only installs the default (x86, clr) runtime of the framework.
# If you need additional architectures or runtimes you should add additional calls
# ex: & $env:USERPROFILE\.dnx\bin\dnvm install $dnxVersion -r coreclr
& $env:USERPROFILE\.dnx\bin\dnvm install $dnxVersion -Persistent
# run DNU restore on all project.json files in the src folder including 2>1 to redirect stderr to stdout for badly behaved tools
Get-ChildItem -Path $PSScriptRoot\src -Filter project.json -Recurse | ForEach-Object { & dnu restore $_.FullName 2>1 }当我使用宿主代理时,这个脚本可以工作,但是当我想使用自托管代理时,我会收到以下错误:
out-file : Access to the path 'C:\1' is denied.
At C:\Users\xy\Desktop\agent\_work\1\s\Prebuild.ps1:28 char:88
+ ... ject.json -Recurse | ForEach-Object { & dnu restore $_.FullName 2>1 }我的自托管代理工作位置是C:\Users\xy\Desktop\agent_work。我看不出有那么多的一个powershell,所以我想请你,帮助。谢谢。
发布于 2016-03-03 02:00:50
这是因为默认情况下,您的自构建代理是以“网络服务”帐户作为服务运行的。
要解决此问题,可以通过命令将其更改为具有管理员权限的帐户运行:
C:\Users\xy\Desktop\agent\Agent\VsoAgent.exe /ChangeWindowsServiceAccount或将生成代理配置为交互式运行,然后以管理员身份运行。
有关详细信息,请参阅此链接:运行代理程序
https://stackoverflow.com/questions/35760318
复制相似问题