小编Hei*_*ner的帖子

如何使用gulp一步复制和注入main-bower文件?

当部署我的应用我想将凉亭依赖复制到deploy该目录的链接,并注入到这些文件到index.html,这也是在deploy目录中.

单独的每一步都完美无缺,因为我无法将它们组合起来.

复制文件:

return gulp.src(mainBowerFiles(), { read: false })
    .pipe(gulp.dest('./deploy/lib/'));
Run Code Online (Sandbox Code Playgroud)

注入文件:

return gulp.src('./deploy/index.html')
    .pipe(plugins.inject(
        gulp.src(mainBowerFiles(), { read: false }), { relative: true }))
    .pipe(gulp.dest('./deploy/'));
Run Code Online (Sandbox Code Playgroud)

我认为我应该一步到位,以保持依赖文件的正确顺序.

我试过这个组合,但没有成功.

return gulp.src('./deploy/index.html')
    .pipe(plugins.inject(
        gulp.src(mainBowerFiles(), { read: false })
            .pipe(gulp.dest('./deploy/lib/'), { relative: true })))
    .pipe(gulp.dest('./deploy/'));
Run Code Online (Sandbox Code Playgroud)

gulp gulp-inject

10
推荐指数
1
解决办法
1万
查看次数

如何在 Microsoft.Rest.ServiceClient 中使用 Windows 身份验证

我有一个Microsoft.Rest.ServiceClient生成的autorest. 我想访问受 Windows 身份验证和基本身份验证保护的 REST API。

目标是使用 Windows 身份验证。我试过如下:

var handler = new HttpClientHandler
{
    UseDefaultCredentials = true,
};
this.InitializeHttpClient(handler);
Run Code Online (Sandbox Code Playgroud)

这不起作用,我得到:

System.Net.Http.HttpRequestException: An error occurred while sending the request. 
---> System.Net.WebException: The remote server returned an error: (401) Unauthorized. 
---> System.ComponentModel.Win32Exception: The target principal name is incorrect
Run Code Online (Sandbox Code Playgroud)

当我使用基本身份验证时,它可以工作。

this.Credentials = new BasicAuthenticationCredentials
{
    UserName = Configuration.User,
    Password = Configuration.Password
};
Run Code Online (Sandbox Code Playgroud)

这个设置ServiceClient是在构造函数中完成的

MyClient : Microsoft.Rest.ServiceClient
Run Code Online (Sandbox Code Playgroud)

我需要向客户端添加什么才能使 Windows 身份验证正常工作?

编辑:

看起来问题出在服务器端。IIS 中的设置。

客户端将按预期工作。

.net c# windows-authentication autorest

6
推荐指数
1
解决办法
1668
查看次数

标签 统计

.net ×1

autorest ×1

c# ×1

gulp ×1

gulp-inject ×1

windows-authentication ×1