小编set*_*dnz的帖子

在自托管VSO代理上运行NPM

我在Azure上使用Azure VM和Visual Studio Release插件设置了VSO代理.我还安装了最新版本的node.js(使用NVM for windows).我在安装VSO代理时使用了默认帐户,因为我用于远程桌面的凭据不起作用.

我可以远程进入机器并运行我试图从VSO运行的构建脚本.我也可以使用它运行纯粹的.NET构建.我的问题在于使用npm来安装我的软件包并运行构建.

我已经像这样建立了对构建的需求:

npm | exists

我从控制面板上设置了VSO代理的功能,如下所示:

npm | C:\Program Files\nodejs\npm.cmd

也试过了

npm | C:\Program Files\nodejs

我可以在该文件夹中看到npm.cmd,当我远程使用该路径时,我可以运行npm.我还根据这个问题重新启动了VSO代理服务:

TFS构建代理无法定位npm

重启服务器并完成了"更新所有代理"几次.我的路径中也有npm,并且能够在登录时正常执行.

编辑:

错误信息:

npm : The term 'npm' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the 
spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\work-folder\1\s\azure-deploy.ps1:24 char:1
+ npm update
+ ~~~
+ CategoryInfo : ObjectNotFound: (npm:String) …
Run Code Online (Sandbox Code Playgroud)

azure node.js npm azure-devops azure-pipelines

5
推荐指数
1
解决办法
4877
查看次数

自动注射IHubContext SignalR MVC

我想让SignalR与Autofac合作.我有一个我在这里所做的剥离版本的回购:

https://github.com/justsayno/signalr-autofac

这是使用GlobalHost以下工作改编的:

https://github.com/sstorie/experiments/tree/master/angular2-signalr

使用hte GlobalHost对象可以正常工作.我试图按照Autofac网站上关于如何注入SignalR服务的文档,但我无法让它工作.这是我的配置文件,用于注册我的依赖项:

public static IContainer RegisterDependencies()
    {
        // Create your builder.
        var builder = new ContainerBuilder();

        //register controllers in DI
        builder.RegisterControllers(Assembly.GetExecutingAssembly());
        builder.RegisterApiControllers(Assembly.GetExecutingAssembly());

        // Register SignalR hubs
        builder.RegisterHubs(Assembly.GetExecutingAssembly());

        return builder.Build();
    }
Run Code Online (Sandbox Code Playgroud)

我从startup.cs中调用它:

public class Startup
{
    public static IContainer Container { get; set; }
    public void Configuration(IAppBuilder app)
    {
        var config = GlobalConfiguration.Configuration;

        // configure IoC container
        Container = AutofacConfiguration.RegisterDependencies();

        //set dependency resolver from WebAPI and MVC
        config.DependencyResolver = new AutofacWebApiDependencyResolver(Container);
        DependencyResolver.SetResolver(new Autofac.Integration.Mvc.AutofacDependencyResolver(Container));

        //register Autofac …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc autofac signalr asp.net-web-api

2
推荐指数
1
解决办法
1407
查看次数