GVKun编程网logo

Web 窗体项目中的 Azure 管道构建错误(azure架构)

17

本文将为您提供关于Web窗体项目中的Azure管道构建错误的详细介绍,我们还将为您解释azure架构的相关知识,同时,我们还将为您提供关于ASP.NETWebformsWebSite的Azure管道、

本文将为您提供关于Web 窗体项目中的 Azure 管道构建错误的详细介绍,我们还将为您解释azure架构的相关知识,同时,我们还将为您提供关于ASP.NET Webforms WebSite的Azure管道、asp.net – Web API – Web窗体项目安全性错误、AWS CDK 管道构造:代码构建错误 254、Azure ARM (22) 使用Azure PowerShell创建Azure RM VM的实用信息。

本文目录一览:

Web 窗体项目中的 Azure 管道构建错误(azure架构)

Web 窗体项目中的 Azure 管道构建错误(azure架构)

我遇到了完全相同的问题。将管道代理规范从 windows-2019 更改为 vs2017-win2016 后,我能够成功运行构建。

,

这是在此处跟踪的已知问题:https://developercommunity.visualstudio.com/t/Starting-today-we-can-no-longer-build-an/1370287,请关注它以获取最新反馈。

顺便说一句,您可以将 self-hosted agents 与之前在管道中工作的特定版本一起使用以继续您的工作。

更新>>产品组已修复此问题,本周发布了包含此修复程序的较新版本 VS,一旦可用,他们将在图像上进行处理,请参阅: https://github.com/actions/virtual-environments/issues/2968#issuecomment-803798593 了解详情。

,

该问题可能与 msbuild 或 build 任务基础结构的更改有关。对于某些项目,如果解决方案包含“网站 {E24C65DC-7377-472B-9ABA-BC803B73C61A}”类型的项目,则构建会在几天前停止工作。

那些在过去 5 到 10 年中都没有得到很好的支持,而且一旦在 Azure DevOps 中构建,就可能没有那么多了,更不用说这可以解释为什么这种回归可能已经溜过了。

,

这里也在跟踪这个问题:

“Windows-2019 映像版本 20210309.0 和 20210316.1 上的 MSBuild 失败并出现错误 MSB4041” https://github.com/actions/virtual-environments/issues/2968

ASP.NET Webforms WebSite的Azure管道

ASP.NET Webforms WebSite的Azure管道

我不想在bin文件夹中获取.compiled文件,我只想在bin文件夹中获取项目的dll。

根据文档File Handling During ASP.NET Precompilation:

对于ASP.NET Web应用程序中的可执行文件,编译器 具有.compiled文件扩展名的程序集和文件。的 程序集名称由编译器生成。 .compiled文件确实 不包含可执行代码。相反,它仅包含信息 ASP.NET需要找到合适的程序集。

在部署预编译的应用程序之后,ASP.NET使用 Bin文件夹中的程序集以处理请求。预编译 输出包括.aspx或.asmx文件作为页面的占位符。的 占位符文件不包含任何代码。它们的存在只是为了提供一种方法 为特定的页面请求调用ASP.NET,以便该文件 可以设置权限以限制对页面的访问。

因此,我们将必须禁用预编译步骤以将其删除。 您只需要将属性/p:PrecompileBeforePublish=true更改为/p:PrecompileBeforePublish=false

,

我想分享我的修正:

我在ASP.NET Webforms 网站项目(不是WebApp)上有一个旧版应用程序。这是Azure Pipeline的设置,也是您在解决方案中必须做的更改:

YAML文件:

    trigger:
- master

name: $(rev:r)-$(Build.DefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)_$(Hours)$(Minutes)$(Seconds)_B-$(BuildID)

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Debug'

steps:
- task: NuGetToolInstaller@1
  displayName: 'Install Nuget'

- task: NuGetCommand@2
  displayName: 'Nuget Command'
  inputs:
    restoreSolution: '$(solution)'

- task: VSBuild@1
  displayName: Build PowerDetails Web Forms
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:ExcludeApp_Data=True /p:PrecompileBeforePublish=True /p:EnableUpdateable=True /p:DebugSymbols=True /p:WDPMergeOption="DonotMerge" /p:WebPublishMethod="FileSystem" /p:PublishProvider="FileSystem" /p:DeleteExistingFiles="True" /p:DeployOnBuild=True /p:PackageLocation="$(Build.ArtifactStagingDirectory)"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'
    maximumCpuCount: true
    vsVersion: 'latest'
- task: PublishPipelineArtifact@1
  displayName: Publish Pipeline Artifact
  inputs:
    targetPath: '$(Pipeline.Workspace)'
    artifact: 'WinForm_Artifacts'
    publishLocation: 'pipeline'

现在,您必须更新SLN文件并为WebSite项目替换此设置:

Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "WebSite1","http://localhost:8080","{BF5B70E3-DC4C-4AE4-BCD8-D0B5D3A6AA66}"
ProjectSection(WebsiteProperties) = preProject
    SccProjectName = "SAK"
    SccAuxPath = "SAK"
    SccLocalPath = "SAK"
    SccProvider = "SAK"
    UseIISExpress = "true"
    TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.6.1"
    ProjectReferences = "{ba89722c-1b24-4da4-b963-0df5cf17af21}|PowerDetail.Web.dll;"
    Debug.AspNetCompiler.Clean = "true"
    Debug.AspNetCompiler.Force = "true"
    Debug.AspNetCompiler.VirtualPath = "/drop"
    Debug.AspNetCompiler.PhysicalPath = "WebSite\"
    Debug.AspNetCompiler.TargetPath = "..\..\temp\drop\"
    Debug.AspNetCompiler.Updateable = "true"
    Debug.AspNetCompiler.ForceOverwrite = "true"
    Debug.AspNetCompiler.FixedNames = "false"
    Debug.AspNetCompiler.Debug = "true"
    Release.AspNetCompiler.Clean = "true"
    Release.AspNetCompiler.Force = "true"
    Release.AspNetCompiler.VirtualPath = "/drop"
    Release.AspNetCompiler.PhysicalPath = "WebSite\"
    Release.AspNetCompiler.TargetPath = "..\..\temp\drop\"
    Release.AspNetCompiler.Updateable = "true"
    Release.AspNetCompiler.ForceOverwrite = "true"
    Release.AspNetCompiler.FixedNames = "false"
    Release.AspNetCompiler.Debug = "true"


    SlnRelativePath = "WebSite\"
    EndProjectSection
EndProject

然后pipelie将生成此工件:

artifact

这就是全部!

asp.net – Web API – Web窗体项目安全性错误

asp.net – Web API – Web窗体项目安全性错误

我在使用Web API的项目时遇到问题.

在global.asax文件中,我有这个,它给出了一个错误

System.Web.Http.WebHost.dll中出现“System.TypeLoadException”类型的异常,但未在用户代码中处理

附加信息:覆盖成员时违反了继承安全规则:’System.Web.Http.WebHost.Routing.HostedHttpRoute.get_RouteTemplate()’.覆盖方法的安全性可访问性必须与被覆盖的方法的安全性可访问性相匹配.

在这条线上

RouteTable.Routes.MapHttpRoute(name:="DefaultApi",routeTemplate:="api/{controller}/{id}",defaults:=New With { _
  Key .id = RouteParameter.[Optional] _

})

我升级了一些包.这曾经是我的packages.config文件

<package id="Microsoft.AspNet.WebApi.Client" version="4.0.20710.0" targetFramework="net45" />
 <package id="Microsoft.AspNet.WebApi.Core" version="4.0.20710.0" targetFramework="net45" />
 <package id="Microsoft.AspNet.WebApi.WebHost" version="4.0.20710.0" targetFramework="net45" />

它们现在升级为:

<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="4.0.30506.0" targetFramework="net45" />

知道为什么我升级后才开始出现这个错误吗?

非常感谢你!

解决方法

我有项目A,它引用了项目B.
在项目B中有控制器,我在那里为这些控制器调用RouteTable.Routes.MapHttpRoute.

在我的案例中我发现问题是项目中的WebApi NuGet包版本高于引用的项目B.

AWS CDK 管道构造:代码构建错误 254

AWS CDK 管道构造:代码构建错误 254

如何解决AWS CDK 管道构造:代码构建错误 254?

我对 AWS CDK 还很陌生,我正在尝试按照此处有关 Cdk 管道构造的教程来构建我自己的管道 https://docs.aws.amazon.com/cdk/latest/guide/cdk_pipeline.html

我尝试从创建一个基本管道开始(请参阅下面的代码) - 但是我在 CodeBuild 中不断收到错误消息,显示 npm ERR! enoent ENOENT: no such file or directory,open ''/codebuild/output/src503090835/src/package.json''。我不完全确定为什么会出现这种情况,因为我使用的是 CdkPipeline 构造,所以我没有直接自己制作 CodeBuild 资源。

有没有人以前经历过这种情况,并且能够解释一下?

lib/pipeline-stack.ts

import { Stack,StackProps,Construct,SecretValue } from ''@aws-cdk/core'';
import { CdkPipeline,SimpleSynthAction } from ''@aws-cdk/pipelines'';

import * as codepipeline from ''@aws-cdk/aws-codepipeline'';
import * as codepipeline_actions from ''@aws-cdk/aws-codepipeline-actions'';

import { GITHUB_VALUES} from ''../lib/constants''

export class Pipelinestack extends Stack {
  constructor(scope: Construct,id: string,props?: StackProps) {
    super(scope,id,props);

    const sourceArtifact = new codepipeline.Artifact();
    const cloudAssemblyArtifact = new codepipeline.Artifact();

    const pipeline = new CdkPipeline(this,''pipeline'',{
      pipelineName: ''cherry-client-pipeline'',cloudAssemblyArtifact,sourceAction: new codepipeline_actions.GitHubSourceAction({
        actionName: ''GitHub'',output: sourceArtifact,oauthToken: SecretValue.secretsManager(GITHUB_VALUES.OAUTH_TOKEN_NAME),trigger: codepipeline_actions.GitHubTrigger.POLL,owner: GITHUB_VALUES.OWNER,repo: GITHUB_VALUES.REPO,branch: ''main''
      }),synthAction: SimpleSynthAction.standardNpmSynth({
        sourceArtifact,buildCommand: ''npm run build''
      }),});
  }
}

bin/pipeline.ts

import ''source-map-support/register'';
import * as cdk from ''@aws-cdk/core'';
import { Pipelinestack } from ''../lib/pipeline-stack'';
import { ENVIRONMENTS } from ''../lib/constants''

const app = new cdk.App();
new Pipelinestack(app,''pipeline-stack'',{
  env: ENVIRONMENTS.DEV
});

app.synth();

cdk.json

{
  "app": "npx ts-node --prefer-ts-exts bin/pipeline.ts","context": {
    "@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true,"@aws-cdk/core:enableStackNameDuplicates": "true","aws-cdk:enableDiffNoFail": "true","@aws-cdk/core:stackRelativeExports": "true","@aws-cdk/aws-ecr-assets:dockerIgnoreSupport": true,"@aws-cdk/aws-secretsmanager:parSEOwnedSecretName": true,"@aws-cdk/aws-kms:defaultKeyPolicies": true,"@aws-cdk/aws-s3:grantWriteWithoutAcl": true,"@aws-cdk/aws-ecs-patterns:removeDefaultDesiredCount": true,"@aws-cdk/aws-rds:lowercaseDbIdentifier": true,"@aws-cdk/aws-efs:defaultEncryptionAtRest": true,"@aws-cdk/aws-lambda:recognizeVersionProps": true,"@aws-cdk/core:newStyleStackSynthesis": true
  }
}

package.json

{
  "name": "pipeline","version": "0.1.0","bin": {
    "pipeline": "bin/pipeline.js"
  },"scripts": {
    "build": "tsc","watch": "tsc -w","test": "jest","cdk": "cdk"
  },"devDependencies": {
    "@aws-cdk/assert": "1.115.0","@types/jest": "^26.0.10","@types/node": "10.17.27","jest": "^26.4.2","ts-jest": "^26.2.0","aws-cdk": "1.115.0","ts-node": "^9.0.0","typescript": "~3.9.7"
  },"dependencies": {
    "@aws-cdk/aws-codebuild": "^1.115.0","@aws-cdk/aws-codepipeline": "^1.115.0","@aws-cdk/aws-codepipeline-actions": "^1.115.0","@aws-cdk/aws-s3-deployment": "^1.115.0","@aws-cdk/core": "1.115.0","@aws-cdk/pipelines": "^1.115.0","source-map-support": "^0.5.16"
  }
}

解决方法

我已经设法找到了一个答案(至少针对我的情况),以防将来对任何人有所帮助。

CdkPipeline 结构有两个主要作用

  • sourceAction 触发时从存储库中抓取代码
  • synthAction 负责建筑

synthAction 有一些默认值,这些默认值在文档/教程中对我来说并不是很明显。例如- 它假设它会在代码仓库的根目录找到 cdk.json 和 (cdk)package.json

我的 cdk 应用程序位于名为“pipeline”的子目录中,因此我需要使用属性 subdirectory

synthAction: SimpleSynthAction.standardNpmSynth({
        sourceArtifact,cloudAssemblyArtifact,subdirectory: ''pipeline'',buildCommand: ''cd ../services/website && npm run build''
      })

Azure ARM (22) 使用Azure PowerShell创建Azure RM VM

Azure ARM (22) 使用Azure PowerShell创建Azure RM VM

  《Windows Azure Platform 系列文章目录》

 

  在Azure China获得VM Image,可以执行下面的脚本。

Get-AzureRmVMImagePublisher -Location chinaeast

Get-AzureRmVMImageOffer -Location chinaeast -PublisherName ''OpenLogic'' 

Get-AzureRmVMImagesku -Location chinaeast -PublisherName ''OpenLogic'' -Offer CentOS

Get-AzureRMVMImage -location chinaeast -publisherName ''OpenLogic'' -sku ''6.9'' -Offer CentOS

Get-AzureRMVMImage -location chinaeast -publisherName ''OpenLogic'' -sku ''6.9'' -Offer CentOS -Version 6.9.20170411

 

  在Azure China创建Linux VM,可以执行下面的脚本。

Login-AzureRmAccount -Environment AzureChinaCloud

#这里设置订阅名称
$subscriptionName = ''订阅名称''

Select-AzureRmSubscription -SubscriptionName $subscriptionName


#需要手动创建虚拟网络
$resourceGroupName = "这里设置资源组"
$virtualNetworkName = "这里设置虚拟网络"

$locationName = "China East"
$virtualNetwork = Get-AzureRmVirtualNetwork -ResourceGroupName $resourceGroupName -Name $virtualNetworkName


#自动创建blob
#$BlobURL = New-AzureRmStorageAccount -Location $locationName -ResourceGroupName $resourceGroupName -Name testvmshstorage -SkuName "Standard_LRS" 
$BlobURL = Get-AzureRmStorageAccount -ResourceGroupName $resourceGroupName -Name testvmshstorage


#新建network interface
#$publicIPAddress = "MyNewPIP"
#$publicIp = New-AzureRmPublicIpAddress -Name $publicIPAddress -ResourceGroupName $ResourceGroupName -Location $locationName -AllocationMethod Dynamic

#虚拟机名称
$vmName = "这里设置虚拟机名称"
$vmSize = "Standard_D3_V2"

#新建Network Security Group:
# Create an inbound network security group rule for port 22
$nsgRuleSSH = New-AzureRmNetworkSecurityRuleConfig -Name default-allow-ssh  -Protocol Tcp `
    -Direction Inbound -Priority 1000 -SourceAddressPrefix * -SourcePortRange * -DestinationAddressPrefix * `
    -DestinationPortRange 22 -Access Allow

$nsgName = $vmName + "-nsg"

# Create a network security group
$nsg = New-AzureRmNetworkSecurityGroup -ResourceGroupName $resourceGroupName -Location $locationName -Name $nsgName -SecurityRules $nsgRuleSSH


#虚拟机创建虚拟网络的第一个子网里
$nicName = $vmName + "-nic"
$networkInterface = New-AzureRmNetworkInterface -ResourceGroupName $resourceGroupName -Name $nicName -Location $locationName -SubnetId $virtualNetwork.Subnets[0].Id -NetworkSecurityGroupId $nsg.Id


#新建可用性组
$avbSetName = "My-AvbSet"
$availabilitySet = New-AzureRmAvailabilitySet -ResourceGroupName $resourceGroupName -Name $avbSetName -Location $locationName

#1.Set the administrator account name and password for the virtual machine.
$username = "Linux用户名";  
$password = ''Linux密码'';  
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force;  
$Cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList ($UserName, $securePassword) 


#2.Choose virtual machine size, set computername and credential  
$VM= New-AzureRmVMConfig -VMName $vmName -VMSize $vmSize  -AvailabilitySetID $availabilitySet.Id -ErrorAction Stop 
$VM = Set-AzureRmVMOperatingSystem -VM $VM -Linux -ComputerName $vmName -Credential $cred -ErrorAction Stop 


#3.Choose source image
$VM = Set-AzureRmVMSourceImage -VM $VM -publisherName ''OpenLogic'' -sku ''6.9'' -Offer CentOS -Version 6.9.20170411


#4.Add the network interface to the configuration
$VM = Add-AzureRmVMNetworkInterface -VM $VM -Id $networkInterface.id


#5.Add storage that the virtual hard disk will use.  
$BlobPath = "vhds/"+ $vmName +"-OSDisk.vhd" 
$OSDiskUri = $BlobURL.PrimaryEndpoints.Blob + $BlobPath 
$DiskName = "linuxvmosdisk" 
$VM = Set-AzureRmVMOSDisk -VM $VM -Name $DiskName -VhdUri $OSDiskUri -CreateOption fromImage -ErrorAction Stop 


#6. Create a virtual machine 
New-AzureRmVM -ResourceGroupName $ResourceGroupName -Location $LocationName -VM $VM -ErrorAction Stop 
Write-Host "Successfully created a virtual machine $VMName" -ForegroundColor Green

 

 

  

今天关于Web 窗体项目中的 Azure 管道构建错误azure架构的介绍到此结束,谢谢您的阅读,有关ASP.NET Webforms WebSite的Azure管道、asp.net – Web API – Web窗体项目安全性错误、AWS CDK 管道构造:代码构建错误 254、Azure ARM (22) 使用Azure PowerShell创建Azure RM VM等更多相关知识的信息可以在本站进行查询。

本文标签: