GVKun编程网logo

Google App Engine Flex-ASP.net核心2.1(google framework 2021)

1

对于GoogleAppEngineFlex-ASP.net核心2.1感兴趣的读者,本文将提供您所需要的所有信息,我们将详细讲解googleframework2021,并且为您提供关于716cssfle

对于Google App Engine Flex-ASP.net核心2.1感兴趣的读者,本文将提供您所需要的所有信息,我们将详细讲解google framework 2021,并且为您提供关于716 css flex布局:flex-flow,flex-direction,flex-wrap,justify-content,align-items,align-content,flex,ord、Angular 5.2使用Asp.net核心2.1更新到angular 6 visual studio mac 7.5.2、asp.net – .NET核心2.0 cookie身份验证 – 不重定向、Asp.net核心2 – WebApi中的外部身份验证的宝贵知识。

本文目录一览:

Google App Engine Flex-ASP.net核心2.1(google framework 2021)

Google App Engine Flex-ASP.net核心2.1(google framework 2021)

如何解决Google App Engine Flex-ASP.net核心2.1

需要您的帮助。我只想在App Engine服务器中找到我的.NET Core 2.1的已发布文件(已发布的物理文件)。我使用Google插件工具发布了我的网站,并且所有操作都是自动完成的。

我正在使用简单的app.yaml文件:

  1. runtime: aspnetcore
  2. env: flex

我尝试扫描App Engine服务器的某些文件夹,但是找不到我的网站。我也想知道也许是因为Google使用了docker(也没有使用docker的经验),而这些文件都在docker的容器中。不太确定。

解决方法

在项目的“云存储桶”列表中,您将找到一个名为artifacts.[project-id].appspot.com的桶。在那里,您会找到部署到App Engine的容器映像。

但是,App Engine提供按需服务器设置和扩展。这意味着,当请求开始进入时,将创建App Engine实例;如果流量增加,则将创建更多实例。

每个实例将分别加载您应用的图片。

在这种类型的环境中,您不应将任何相关信息存储在App的目录中,因为当实例由于流量不足而被杀死时,所有信息都将被擦除,并且在一个实例中存储的数据将不可用。其他情况。有关更多信息,请参见how instances are managed。

如果您希望应用程序将数据存储在SQL数据库中,则可以查看Cloud SQL,或者,您可能会发现Cloud Firestore(这是一个NoSQL数据库)可以满足您的要求。需要。这是list of GCP databases

716 css flex布局:flex-flow,flex-direction,flex-wrap,justify-content,align-items,align-content,flex,ord

716 css flex布局:flex-flow,flex-direction,flex-wrap,justify-content,align-items,align-content,flex,ord

认识flex布局


flex布局模型


flex相关的属性


Flex-direction


Justify-content


align-items


flex-wrap、flex-flow


align-content


order


align-self


flex-grow


flex-shrink


flex-basis


flex


09_flex布局的使用01.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <Meta charset="UTF-8" />
    <Meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <Meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>

    <style>
      .Box {
        width: 550px;
        height: 400px;
        background-color: pink;
        margin: 0 auto;

        /* 
          1.开启flex布局:
            flex: 块级元素
            inline-flex: 行内元素
        */
        display: flex;

        /* 2.flex-direction: 决定主轴的方向 */
        /* row: 主轴从左到右 */
        /* row-reverse: 主轴从右到左 */
        /* column: 主轴从上到下 */
        /* column-reverse: 主轴从下到上 */
        /* flex-direction: column-reverse; */

        /* 3.justify-content: 决定flex items主轴的对齐方式 */
        /* justify-content: space-around; */

        /* 4.align-items: 绝定flex items在交叉轴的对齐方式 */
        /* align-items: baseline; */

        /* 5.结论: 默认情况下, 所有的flex items都会在同一行显示 */
        /* flex-wrap: Nowrap */
        /* Nowrap: 不换行 */
        /* flex-wrap: wrap-reverse; */

        /* 6.flex-flow: 缩写属性 -> flex-direction || flex-wrap */
        flex-flow: row wrap;
        justify-content: space-evenly;

        /* 7.align-content: 决定多行的flex items在交叉轴上的对齐方式 */
        align-content: space-around;
      }

      .item {
        width: 100px;
        height: 100px;
        color: #fff;
        text-align: center;
      }

      .item1 {
        background-color: #f66;
        /* height: 60px; */
        /* font-size: 50px; */
      }

      .item2 {
        background-color: yellowgreen;
        /* height: 150px; */
      }

      .item3 {
        background-color: skyblue;
        /* height: 120px; */
      }
    </style>
  </head>
  <body>
    <div/tag/Box/" target="_blank">Box">
      <div>item1</div>
      <div>item2</div>
      <div>item3</div>
      <div>item4</div>
      <div>item5</div>
      <div>item6</div>
      <div>item7</div>
      <div>item8</div>
      <div>item9</div>
    </div>

    <strong>strong元素</strong>
  </body>
</html>

10_flex布局的使用02.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <Meta charset="UTF-8" />
    <Meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <Meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>

    <style>
      .Box {
        width: 550px;
        height: 400px;
        background-color: orange;
        margin: 0 auto;

        /* 1.开启flex布局*/
        display: flex;

        /* align-items: center; */
        /* flex-wrap: wrap; */
      }

      /* 
         750px - 550px = 200px
         200 / 3 = 66.66666px
         250 - 66 = 
        */

      /* 
        200 / 5 = 40
        
         */

      .item {
        width: 100px;
        height: 100px;
        color: #fff;
        text-align: center;

        /* 1: flex-grow */
        flex: 1;
      }

      .item1 {
        background-color: #f66;
        /* order: 10; */
        /* flex-grow: .2;  */
        /* flex-shrink: .2; */

        /* flex-basis: 200px; */
      }

      .item2 {
        background-color: #0f0;
        /* height: 150px; */
        /* order: 6; */
        /* flex-grow: .2;  */
        /* flex-shrink: .2; */
      }

      .item3 {
        background-color: #00f;
        /* align-self: flex-end; */
        /* order: 100; */
        /* flex-grow: .3; */
        /* flex-shrink: .2; */
      }
    </style>
  </head>
  <body>
    <div/tag/Box/" target="_blank">Box">
      <div>item1</div>
      <div>item2</div>
      <div>item3</div>
    </div>

    <strong>strong元素</strong>
  </body>
</html>

Angular 5.2使用Asp.net核心2.1更新到angular 6 visual studio mac 7.5.2

Angular 5.2使用Asp.net核心2.1更新到angular 6 visual studio mac 7.5.2

我正在尝试使用以下命令从.netcore 2.1核心模板更新Angular 5.2
dotnet new angular -o my-new-app
cd my-new-app
cd ClientApp
npm install --save <package_name>

用于创建角度项目的链接 – https://docs.microsoft.com/en-us/aspnet/core/spa/angular?view=aspnetcore-2.1&tabs=visual-studio

现在我按照链接更新到Angular 6 How to update / upgrade from Angular 4 to Angular 5+

使用另一个链接进行更新,但所有链接都显示相同的错误
https://asish.com.au/how-to-upgrade-angular-5-application-to-angular-6-with-visual-studio-2017/

https://update.angular.io/

但是得到很多错误

处理请求时发生未处理的异常.
AggregateException:发生一个或多个错误. (发生了一个或多个错误.(NPM脚本’start’退出但未指示Angular CLI正在侦听请求.错误输出为:UnkNown选项:’ – extraxtCss’
))

这是我的Package.json文件

{
  "name": "WebApp","version": "0.0.0","license": "MIT","scripts": {
    "ng": "ng","start": "ng serve --extract-css","build": "ng build --extract-css","build:ssr": "npm run build -- --app=ssr --output-hashing=media","test": "ng test","lint": "ng lint","e2e": "ng e2e"
  },"private": true,"dependencies": {
    "@angular/animations": "^6.0.4","@angular/common": "^6.0.4","@angular/compiler": "^6.0.4","@angular/core": "^6.0.4","@angular/forms": "^6.0.4","@angular/http": "^6.0.4","@angular/platform-browser": "^6.0.4","@angular/platform-browser-dynamic": "^6.0.4","@angular/platform-server": "^6.0.4","@angular/router": "^6.0.4","@nguniversal/module-map-ngfactory-loader": "^6.0.0","aspnet-prerendering": "^3.0.1","bootstrap": "^4.1.1","core-js": "^2.4.1","rxjs": "^6.2.0","zone.js": "^0.8.26"
  },"devDependencies": {
    "@angular-devkit/build-angular": "~0.6.8","@angular/cli": "^6.0.8","@angular/compiler-cli": "^6.0.4","@angular/language-service": "^6.0.4","@types/jasmine": "~2.8.3","@types/jasminewd2": "~2.0.2","@types/node": "~10.3.1","codelyzer": "^4.0.1","jasmine-core": "~3.1.0","jasmine-spec-reporter": "~4.2.1","karma": "^2.0.2","karma-chrome-launcher": "~2.2.0","karma-coverage-istanbul-reporter": "^2.0.1","karma-jasmine": "~1.1.0","karma-jasmine-html-reporter": "^1.1.0","protractor": "^5.3.2","ts-node": "~6.1.0","tslint": "~5.10.0","typescript": "~2.9.1"
  },"optionalDependencies": {
    "node-sass": "^4.9.0"
  }
}

Start.cs中

public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            // In production,the Angular files will be served from this directory
            services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "ClientApp/dist";
            });
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app,IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseSpaStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",template: "{controller}/{action=Index}/{id?}");
            });

            app.UseSpa(spa =>
            {
                // To learn more about options for serving an Angular SPA from ASP.NET Core,// see https://go.microsoft.com/fwlink/?linkid=864501

                spa.Options.sourcePath = "ClientApp";

                if (env.IsDevelopment())
                {
                    spa.UseAngularCliServer(npmScript: "start");
                }
            });
        }
    }

angular.json

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json","version": 1,"newProjectRoot": "projects","projects": {
    "WebApp": {
      "root": "","sourceRoot": "src","projectType": "application","architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser","options": {
            "outputPath": "dist","index": "src/index.html","main": "src/main.ts","tsConfig": "src/tsconfig.app.json","progress": true,"polyfills": "src/polyfills.ts","assets": [
              "src/assets"
            ],"styles": [
              "src/styles.css","node_modules/bootstrap/dist/css/bootstrap.min.css"
            ],"scripts": []
          },"configurations": {
            "production": {
              "optimization": true,"outputHashing": "all","sourceMap": false,"extractCss": true,"namedChunks": false,"aot": true,"extractLicenses": true,"vendorChunk": false,"buildOptimizer": true,"fileReplacements": [
                {
                  "replace": "src/environments/environment.ts","with": "src/environments/environment.prod.ts"
                }
              ]
            }
          }
        },"serve": {
          "builder": "@angular-devkit/build-angular:dev-server","options": {
            "browserTarget": "WebApp:build"
          },"configurations": {
            "production": {
              "browserTarget": "WebApp:build:production"
            }
          }
        },"extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n","options": {
            "browserTarget": "WebApp:build"
          }
        },"test": {
          "builder": "@angular-devkit/build-angular:karma","options": {
            "main": "src/test.ts","karmaConfig": "./karma.conf.js","tsConfig": "src/tsconfig.spec.json","scripts": [],"assets": [
              "src/assets"
            ]
          }
        },"lint": {
          "builder": "@angular-devkit/build-angular:tslint","options": {
            "tsConfig": [
              "src/tsconfig.app.json","src/tsconfig.spec.json"
            ],"exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },"WebApp-e2e": {
      "root": "","sourceRoot": "e2e","architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor","options": {
            "protractorConfig": "./protractor.conf.js","devServerTarget": "WebApp:serve"
          }
        },"options": {
            "tsConfig": [
              "e2e/tsconfig.e2e.json"
            ],"exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },"defaultProject": "WebApp","schematics": {
    "@schematics/angular:component": {
      "prefix": "app","styleext": "css"
    },"@schematics/angular:directive": {
      "prefix": "app"
    }
  }
}

错误详情

任何人都可以让我知道如何通过适当的链接将角度5.2转换为角度6

将角度5.2更新为6的完整步骤
dotnet new angular -o my-new-app
cd my-new-app
cd ClientApp
npm install

首先,使用以下命令将Angular CLI全局更新为最新版本:

npm install -g @angular/cli

接下来,我们需要更新特定于应用程序的Angular CLI本地版本.为此,请导航到Angular应用程序根文件夹(package.json所在的位置)并运行以下命令.

npm install @angular/cli

Angular CLI现在支持包含多个项目的工作区,例如多个应用程序或库.因此,现在可以在同一个CLI项目中创建多个应用程序(称为工作空间),并创建库(一组共享的组件,指令,管道和服务)!这个新架构使用angular.json而不是.angular-cli.json进行构建和项目配置.因此,需要删除.angular-cli.json文件,并且需要在项目中添加新的angular.json文件.别担心,您不必手动执行此操作.运行以下命令将配置文件转换为新格式(angular.json).

ng update @angular/cli

成功完成此命令后,您可以在解决方案资源管理器中看到angular.json文件.我必须运行此命令两次以获取新文件.因此,如果您在第一次运行该命令后在解决方案资源管理器中找不到新的angular.json文件,请再试一次.

接下来,是时候将所有框架包升级到Angular 6.为此,请运行以下命令:

ng update @angular/core

所有Angular框架包都升级到Angular 6.您可以通过package.json文件对其进行验证.

接下来,运行ng update以识别和更新其他依赖项.

Angular 6现在依赖于TypeScript 2.7和RxJS 6.因此,我们需要升级RxJS.您将考虑在使用RxJS导入和运算符的任何地方手动更改代码.别担心,有一个包装可以解决这个问题.运行以下命令以升级RxJS.

npm install -g rxjs-tslint
rxjs-5-to-6-migrate -p src/tsconfig.app.json

完成后,删除rxjs-compat.此软件包需要向后兼容版本6之前的RxJS.但是,现在不再需要它,所以让我们使用以下命令将其删除:

npm uninstall rxjs-compat

现在,运行ng来查看应用程序正在构建和运行而没有任何错误.还剩下一件事.如果我们从Visual Studio 2017构建应用程序并运行它,您可能会在浏览器中看到以下异常.
InvalidOperationException:NPM脚本“start”退出,但未指示Angular CLI正在侦听请求.错误输出为:未知选项:’ – extxtCss’

这是因为ng serve命令不再支持–extractCss选项. extractCSS是一个JavaScript库和一个在线工具,可以从HTML文档中提取元素ID,类和内联样式,并将它们输出为CSS样式表.此选项在ng服务上不可用,因为它是与构建相关的选项,而不是与服务相关的选项.

要解决此问题,请从package.json文件的scripts部分中的ng serve命令中删除–extract-css选项.

"start": "ng serve"

保存package.json文件,构建应用程序并再次运行.您应该会在浏览器中看到该应用正在运行

来源链接 – http://www.talkingdotnet.com/upgrade-angular-5-app-angular-6-visual-studio-2017/

asp.net – .NET核心2.0 cookie身份验证 – 不重定向

asp.net – .NET核心2.0 cookie身份验证 – 不重定向

参见英文答案 > ASP.NET Core 2.0 disable automatic challenge                                    7个
我正在使用带有cookie身份验证的.NET核心2.0.
我的配置如下所示:

services
  .AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
  .AddCookie(options =>
  {
      options.ExpireTimeSpan = TimeSpan.FromDays(1);
      options.SlidingExpiration = true;
      options.Cookie.Name = "authtoken";
  });

当我访问未经授权的控制器时,我被重定向到/ Account / Login

在.NET Core 1.1中,我可以通过设置来配置它
AutomaticChallenge = false.
如何在.NET Core 2.0中配置它?
我只是希望我的控制器返回HTTP 403.

解决方法

不幸的是,这个旗帜已被完全删除.但是,您可以在startup.cs的ConfigureServices方法中覆盖“RedirectToLogin”事件

services.AddAuthentication("CookieAuthenticationScheme")
    .AddCookie(options => {
        options.Events.OnRedirectToLogin = (context) =>
        {
            context.Response.StatusCode = 401;
            return Task.CompletedTask;
        };
    });

如果您在升级时遇到困难,请在此处添加更多花絮:https://dotnetcoretutorials.com/2017/09/16/cookie-authentication-asp-net-core-2-0/

我是否正确地认为这是因为它是您正在进行的ajax调用(或者通常是Web API?).看起来MS已经很难用JWT用于Web API,而Cookie只用于MVC.因此为什么强制登录页面.

Asp.net核心2 – WebApi中的外部身份验证

Asp.net核心2 – WebApi中的外部身份验证

现在我知道有很多关于这个的帖子,但我的情况有所不同.所以请耐心等待.

当我在.Net Framework上创建WebApi并选择个人用户帐户时,它已经为我提供了一个外部身份验证的工作代码.

有AccountController,Startup.auth.cs和其他具有外部身份验证代码的文件

现在我知道.net核心已经发生了变化.但个人用户帐户的net.core web api与它没有任何相似之处.

当我尝试在.net Core上使用WebApi时,它只为我提供了一个选择Azure应用程序的选项.
在下图中,使用.net核心上的WebApi,蓝色指向的下拉列表仅提供一个Azure AD b2c应用程序选项.没有帐户控制器是脚手架,也没有其他配置文件用于外部身份验证.

没有我需要的文件.

我试过这些链接:
https://docs.microsoft.com/en-us/aspnet/web-api/overview/security/external-authentication-services

https://docs.microsoft.com/en-us/aspnet/core/security/authentication/social/

但第一个链接是针对.net框架,但对我没有帮助.第二个仅适用于asp.net核心上的Web应用程序,但不适用于WebApi

我需要在web api中进行外部身份验证,因为我希望所有来自Web或移动设备的用户都可以通过Google或Facebook进行身份验证.
请任何人指出我正确的方向.我在这里错过了一些东西.有没有文件可以帮我解决这个问题?

解决方法

选择“个人用户帐户”时,您要选择“在应用程序中存储用户帐户”.

以这种方式创建应用程序时,脚手架将创建AccountController.
以这种方式创建项目后,您可以转到Startup.cs

在ConfigureServices方法中,您必须添加(对于谷歌):

services.AddAuthentication()
    .AddGoogle(options => 
    {
        //Set client Id and secret here
        options.ClientId = "clientId_here";
        options.ClientSecret = "ClientSecret_here";
    });

欲了解更多信息,请访问:https://docs.microsoft.com/en-us/aspnet/core/security/authentication/social/

关于Google App Engine Flex-ASP.net核心2.1google framework 2021的介绍现已完结,谢谢您的耐心阅读,如果想了解更多关于716 css flex布局:flex-flow,flex-direction,flex-wrap,justify-content,align-items,align-content,flex,ord、Angular 5.2使用Asp.net核心2.1更新到angular 6 visual studio mac 7.5.2、asp.net – .NET核心2.0 cookie身份验证 – 不重定向、Asp.net核心2 – WebApi中的外部身份验证的相关知识,请在本站寻找。

本文标签: