我在VS2015中有一个我想在本地IIS上运行的Web项目.我在项目属性中设置它并且它可以正常工作,但每当我关闭并重新打开Visual Studio时,它总是重置项目以使用IIS Express.
编辑:当我关闭并重新打开解决方案时,即使Visual Studio保持打开状态,也会发生这种情况.
为什么会发生这种情况,我该如何改变呢?(注意 - 其他用户正在处理同一个项目,因此我不想将我的本地IIS设置存储在项目文件中,因为我认为这会在他们获得最新版本的代码时覆盖他们的设置.)
如何从 luxon dateTime 对象获取时间戳?
例如?
const { DateTime } = require("luxon");
date = DateTime.now().setZone('utc');
date.endOf('day);
console.log(date.???) // should give something like 1629399474922
Run Code Online (Sandbox Code Playgroud)
这应该相当于javascript的Date.getTime()
功能。
我目前有一个大型的打字稿文件,我想分开.有一些函数和变量仅在文件中使用,还有许多类.它目前看起来像这样:
var numbers = [1, 2, 3];
function formatDate() {...}
class Widget { ... }
class Section { ... }
Run Code Online (Sandbox Code Playgroud)
我已经尝试将它放在一个模块中并将其拆分为几个文件:
//Widget.ts
module ReportTemplate {
export class Widget { ... }
}
//Section.ts
module ReportTemplate {
export class Section { ... }
}
//ReportTemplate.ts
/// <reference path="Widget.ts"/>
/// <reference path="Section.ts"/>
module ReportTemplate {
var numbers = [1, 2, 3];
function formatDate() { ... }
}
Run Code Online (Sandbox Code Playgroud)
我希望这相当于我的原始文件,但包含在一个模块中,但我发现的是,Widget
并且Section
无法访问numbers
和formatDate
.
我不确定我是否只是误解了引用,所以我尝试添加对ReportTemplate.ts
in的引用Section.ts
,Widget.ts …
我在 .net5 (又名)中有一个 Azure 函数dotnet-isolated
,并且我添加了这样的实体框架
services.AddDbContext<EfDbContext>(options =>
{
options.UseSqlServer(context.Configuration[...], builder =>
{
builder.EnableRetryOnFailure();
});
});
Run Code Online (Sandbox Code Playgroud)
当我运行该函数时,我在控制台中看到来自 EF 的数据库查询(根据颜色判断信息级别)。
我怎样才能禁用它们?我在我的中尝试了明显的选项host.json
:
"logging": {
"logLevel": {
"Microsoft.EntityFrameworkCore": "Warning",
}
}
Run Code Online (Sandbox Code Playgroud)
和
"logging": {
"logLevel": {
"default": "Information",
"Microsoft.EntityFrameworkCore": "Warning",
"Microsoft.EntityFrameworkCore.Database": "Warning",
"Microsoft.EntityFrameworkCore.Query": "Warning"
}
}
Run Code Online (Sandbox Code Playgroud)
甚至
"logging": {
"logLevel": {
"Microsoft": "Warning",
}
}
Run Code Online (Sandbox Code Playgroud)
但这没有帮助。唯一有效的选择是
"logging": {
"logLevel": {
"default": "Warning",
}
}
Run Code Online (Sandbox Code Playgroud)
我错过了什么吗?
我有一个应用程序,正在为 Azure DevOps 创建构建管道。它使用私有 npm 注册表中的 npm 包(包含从不同的 Azure DevOps 组织创建的代码)。当我运行npm ci
(或npm install
)时,它失败并出现以下错误:
npm 错误!代码E401
npm 错误!无法进行身份验证,需要:承载授权_uri = https://login.windows.net/b2d01466-6e2c-4b55-8b90-e3ed41afca4a,基本领域 =“https://pkgsproduks1.pkgs.visualstudio.com/”,TFS-Federated
失败的特定包是来自其他组织的包,401
当尝试获取它们时会返回 a 。
我认为验证这一点的最佳实践是在 Azure DevOps 中创建服务连接。我在托管 npm 包的组织内创建了一个个人访问令牌,并使用它在包含我的构建管道的组织中创建了一个服务连接。然后我将其包含在我的构建管道 yaml 中,如下所示:
- task: Npm@1
displayName: Install npm packages
inputs:
command: 'ci'
workingDir: 'Path/To/Working/Directory'
customEndpoint: 'Custom npm registry'
Run Code Online (Sandbox Code Playgroud)
我还尝试过npm authenticate
在此之前使用构建步骤(无论有没有customEndpoint: 'Custom npm registry'
安装步骤),虽然npm authenticate
运行成功,但对我收到的错误没有任何影响。我还尝试将服务连接设置为使用我的用户名和密码而不是 PAT,但这也没有什么区别。
我的项目中的内容.npmrc
如下(略有修改):
registry=https://registry.npmjs.org/
@{scope}:registry=https://pkgs.dev.azure.com/{organisation}/_packaging/{feedName}/npm/registry/
@{scope}:always-auth=true
Run Code Online (Sandbox Code Playgroud)
任何人都可以看到身份验证有什么问题,或者链接到提供跨多个 Azure DevOps 组织执行此操作的示例的文章吗?
我有一个要进行单元测试的 Web API 控制器方法。它接受 aHttpRequestMessage
但我不知道如何设置我想要传入的内容。是否可以创建/模拟 aHttpRequestMessage
以便我可以给它一个string
我想要的结果await request.Content.ReadAsStringAsync()
?
这是我的控制器方法:
[HttpPost]
public async Task<HttpResponseMessage> Post(HttpRequestMessage request)
{
var data = await request.Content.ReadAsStringAsync();
//do something with data
}
Run Code Online (Sandbox Code Playgroud)
我可以HttpRequestMessage
使用其无参数构造函数轻松创建,但我无法弄清楚如何将内容设置为有意义的值。我希望我的测试按照以下方式工作:
[TestMethod]
public async Task PostMethodWorks()
{
var controller = new MyController();
var data = "this will be JSON";
var httpRequestMessage = new HttpRequestMessage();
//set the content somehow so that httpRequestMessage.Content.ReadAsStringAsync returns data
var response = await controller.Post(httpRequestMessage);
//assert something about the response here
} …
Run Code Online (Sandbox Code Playgroud) 这些是在不同版本的 NuGet 包之间迁移的重要指南:
然而,我正在努力在代码中迁移以下概念:
// Return if a directory exists:
container.GetDirectoryReference(path).ListBlobs().Any();
Run Code Online (Sandbox Code Playgroud)
哪里GetDirectoryReference
不明白并且似乎没有直接翻译。
此外,a 的概念CloudBlobDirectory
似乎并未出现在Azure.Storage.Blobs
例如
// Return if a directory exists:
container.GetDirectoryReference(path).ListBlobs().Any();
Run Code Online (Sandbox Code Playgroud)
whereCloudBlobDirectory
没有出现在 API 中的任何地方。
我正在使用ng-select
显示我的应用程序从 API 检索到的数据,但尽管数据已成功检索到,但下拉列表中并未显示任何内容。它只是说“未找到任何项目”。在控制台中,我有以下错误:
ERROR TypeError: Cannot read property '$ngoptionlabel' of null
这是我的打字稿代码:
// in a service, using HttpClient
this.http.get<string[]>(url);
Run Code Online (Sandbox Code Playgroud)
// in a component, using the service injected in
data: string[] = [];
this.service.get()
.subscribe(data => {
this.data = data; // data contains values as expected
// other logic
});
Run Code Online (Sandbox Code Playgroud)
在我的模板中,我传递this.data
给ng-select
.
<ng-select [items]="data"
[multiple]="true"
[closeOnSelect]="false"
[searchable]="true">
</ng-select>
Run Code Online (Sandbox Code Playgroud)
我认为错误听起来可能与bindLabel
选项有关,但我没有使用它。错误是什么意思,我该如何解决?
我正在使用 Flexbox,我需要反转内容。这很好用,但是列表中有很多项目,最新的项目位于顶部。目前,弹性框自动滚动到底部,我需要它从顶部开始。
有什么建议么?
#viewed {
overflow-y: auto;
margin-bottom: 10px;
height: calc(100% - 10px);
flex: 1 1 auto;
flex-direction: column-reverse;
display: flex;
}
Run Code Online (Sandbox Code Playgroud)
新的 div 是动态从 Firebase 中提取的。
如何在 intelliJ Idea (2018.3) 中审查 git pull 请求并在批准或拒绝之前检查编译时间、测试运行影响和其他 IDE 功能?
javascript ×3
angular ×1
azure-devops ×1
bitbucket ×1
c# ×1
css ×1
html ×1
iis ×1
intellij-13 ×1
logging ×1
luxon ×1
npm ×1
pull-request ×1
typescript ×1
unit-testing ×1