IIS 10.0无法通过PowerShell连接到Nuget Feed
我正在使用IIS 10.0的Web服务器上自动构建C#应用程序,我的代码为PowerShell.sdk生成了命令。
using(PowerShell pws = PowerShell.Create())
{
var cmd = $"set-location \"{slnDirectory}\"";
cmd += $"&\"{nugetPath}\" restore -packagesDirectory \"{packagesPath}\" -configFile \"{config}\""
pws.Commands.AddScript(cmd);
var result = pws.Invoke();
}
生成这样的生成:
set-location ...\project\
&\"...\nuget.exe" restore -packagesDirectory "...\outDir\" -configFile "...\NuGet.Config"
config:
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3">
</packageSources>
<config>
<add key="http_proxy" value="serverX">
<add key="http_proxy.user" value="userX">
<add key="http_proxy.password" value="passX">
</config>
</configuration>
主要问题是带有答案的命令“不可能为源加载服务索引...。 PowerShell,然后一切正常。一切都可以在调试中起作用。问题仅是通过IIS
I am doing an automatic build of C# applications on a web server with IIS 10.0, my code generates a command for PowerShell.SDK.
using(PowerShell pws = PowerShell.Create())
{
var cmd = quot;set-location \"{slnDirectory}\"";
cmd += quot;&\"{nugetPath}\" restore -packagesDirectory \"{packagesPath}\" -configFile \"{config}\""
pws.Commands.AddScript(cmd);
var result = pws.Invoke();
}
Generates like this:
set-location ...\project\
&\"...\nuget.exe" restore -packagesDirectory "...\outDir\" -configFile "...\NuGet.Config"
Config:
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3">
</packageSources>
<config>
<add key="http_proxy" value="serverX">
<add key="http_proxy.user" value="userX">
<add key="http_proxy.password" value="passX">
</config>
</configuration>
The main problem is that the command with the answer "It is not possible to load the service index for the source...." does not work through IIS, but if it is run directly on the server via PowerShell, then everything works correctly. Everything works in debugging. The problem is only through IIS
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论