小编Vin*_*mth的帖子

Docker-compose 覆盖不覆盖连接字符串

我有一个连接到 SQL 数据库的 ASP.NET Web 应用程序。

appsettings.Development.json连接字符串中定义为

"ConnectionStrings": {
    "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=WebRecipes-LocalDev;Trusted_Connection=True;ConnectRetryCount=0"
  }
Run Code Online (Sandbox Code Playgroud)

在我的docker-compose.yml文件中,我得到了最新的mssql-server-linux

services:
  sql.data:
      image: microsoft/mssql-server-linux:2017-latest

  webrecipes.api:
     image: ${DOCKER_REGISTRY-}webrecipesapi
     build:
       context: .
       dockerfile: src/WebRecipes.Api/Dockerfile
Run Code Online (Sandbox Code Playgroud)

docker-compose.override.ymlsql.data为我的 asp.net 核心应用程序设置用户名和密码并覆盖连接字符串

services:
  sql.data:
    environment:
      - SA_PASSWORD=Pass@word
      - ACCEPT_EULA=Y
    ports:
      - "5533:1433"

  webrecipes.api:
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - ASPNETCORE_URLS=https://+:443;http://+:80
      - ASPNETCORE_HTTPS_PORT=44302
      - ConnectionString=Server=sql.data;database=WebRecipes-LocalDev;User Id=sa;Password=Pass@word
    ports:
      - "2282:80"
      - "44302:443"
    volumes:
      - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
      - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
    depends_on:
      - sql.data
Run Code Online (Sandbox Code Playgroud)
  • 编辑:我还尝试将连接字符串设置为:

- ConnectionStrings:DefaultConnection=sql.data;database=WebRecipes-LocalDev;User Id=sa;Password=Pass@word

当我运行应用程序并且它第一次尝试访问数据库时,我收到错误消息,说不支持 LocalDb,因为它使用了中定义的连接字符串 appsettings.Development.json

有人能帮忙吗?我不明白我做错了什么......

sql-server docker-compose asp.net-core

4
推荐指数
2
解决办法
2577
查看次数

为什么我的Azure WebJob没有预定?

我有一个ASP.NET MVC5应用程序在Azure中作为App Service运行,并希望安排WebJob每小时执行一个控制台应用程序.

在控制台应用程序中,我将webjob-publish-settings.json文件定义为:

{
  "$schema": "http://schemastore.org/schemas/json/webjob-publish-settings.json",
  "webJobName": "EpisodeUpdater",
  "startTime": "2017-05-01T00:00:00-08:00",
  "endTime": "2020-06-01T00:00:00-08:00",
  "jobRecurrenceFrequency": "Hour",
  "interval": 1,
  "runMode": "Scheduled"
}
Run Code Online (Sandbox Code Playgroud)

当我看着在Azure门户WebJob类型显示为要设置触发 -当我手动启动它的任务将成功运行,但它不执行每隔一小时.

WebJobs

WebJob属性

任何人都可以看到为什么WebJob没有正确安排?

c# asp.net-mvc azure azure-webjobs

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

用于 Twitter API created_at 字段的 C# DateTime

v1 Twitter APIcreated_at以以下格式返回日期:

Mon Dec 28 11:32:24 +0000 2020
Run Code Online (Sandbox Code Playgroud)

如何将其解析为 C# DateTime?我想我需要使用ParseExact方法,但我不确定格式字符串应该是什么以及我如何弄清楚它

任何人都可以帮忙吗?

c# twitter .net-core

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

为什么我的 go lang 字符串比较没有按预期工作?

我正在尝试并Go编写了一些代码来检查是否输入了yn :

reader := bufio.NewReader(os.Stdin)
fmt.Print("(y / n): ")
text, _ := reader.ReadString('\n')
text = strings.ToLower(text)

if strings.Compare(text, "y") == 0 { 
    fmt.Println("True")
} else {
    fmt.Println("Else")
}
Run Code Online (Sandbox Code Playgroud)

当我运行此代码并输入y(并按 Enter)时,我希望看到True但我得到Else- 谁能明白为什么?

go

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

类型错误:对象不支持属性或方法“条目”(IE11)

我有一个用 Aurelia 编写的应用程序,它需要在 IE11 中运行。

直到上周该应用程序运行正常,但现在当我尝试运行它时,我在控制台中收到以下错误

TypeError: Object doesn't support property or method 'entries'
Run Code Online (Sandbox Code Playgroud)

我不知道是什么原因造成的。我已经回到一个月前的提交,该应用程序肯定可以在 IE11 中运行,但我遇到了同样的错误。

我们Yarn用于包管理Webpack

完整的堆栈转储是:

{
   [functions]: ,
   __proto__: { },
   __symbol:__symbol:rxSubscriber0.6484791277649529: undefined,
   __symbol:hasInstance0.64847912776495296: undefined,
   __symbol:isConcatSpreadable0.64847912776495297: undefined,
   __symbol:iterator0.64847912776495291: undefined,
   __symbol:match0.64847912776495292: undefined,
   __symbol:replace0.64847912776495293: undefined,
   __symbol:search0.64847912776495294: undefined,
   __symbol:species0.64847912776495299: undefined,
   __symbol:split0.64847912776495295: undefined,
   __symbol:toPrimitive0.648479127764952910: undefined,
   __symbol:toStringTag0.648479127764952911: undefined,
   __symbol:unscopables0.64847912776495298: undefined,
   description: "Object doesn't support property or method 'entries'",
   message: "Object doesn't support property or method 'entries'",
   name: "TypeError",
   number: -2146827850,
   stack: "TypeError: Object doesn't support property or method …
Run Code Online (Sandbox Code Playgroud)

javascript internet-explorer-11 aurelia

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

如何找到 Elastic NEST 查询的总命中数?

在我的应用程序中,我有一个查询将返回的命中数限制为 50,如下所示

            var response = await client.SearchAsync<Episode>(s => s
                .Source(sf => sf
                     .Includes(i => i
                         .Fields(
                             f => f.Title,
                             f => f.PublishDate,
                             f => f.PodcastTitle
                         )
                     )
                     .Excludes(e => e
                         .Fields(f => f.Description)
                     )
                 )
                .From(request.Skip)
                .Size(50)
                .Query(q => q 
                    .Term(t => t.Title, request.Search) || q
                    .Match(mq => mq.Field(f => f.Description).Query(request.Search))));
Run Code Online (Sandbox Code Playgroud)

我对查询总命中数感兴趣(即不限于大小),以便我可以在前端处理分页。有谁知道我怎么能做到这一点?

elasticsearch nest

0
推荐指数
2
解决办法
766
查看次数