小编Dev*_*aos的帖子

如何使用配置转换删除环境变量

我有 web.config 和这两个我需要删除的环境变量,请参见下面的 web.config ..

web.config
      <aspNetCore processPath=".\Widgets.API.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess">
        <environmentVariables>
          <environmentVariable name="COMPLUS_ForceENC" value="1" />
          <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
          <environmentVariable name="CORECLR_ENABLE_PROFILING" value="1" />
Run Code Online (Sandbox Code Playgroud)

我正在尝试使用删除这些变量

web.Release.config

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <location>
    <system.webServer>
      <aspNetCore>
        <!--remove the environment vars section in Release mode-->
        <!--
        Why? Because .NET Core has a bug where it adds environmentVariables section
        during the build with the environment set as Development..  
        This obviously fails in production, which is why we remove it during 
        release.
      -->
        <environmentVariable name="COMPLUS_ForceENC" value="1" …
Run Code Online (Sandbox Code Playgroud)

.net xml web-config visual-studio web.config-transform

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

如何使用 powershell 设置 IIS 应用程序池 Cpu 速率限制

我正在尝试设置 cpu 速率限制,我能够使用操作链接在 UI 中执行此操作

https://theitbros.com/set-cpu-usage-limit-for-an-application-pool-iis-8/

但我想使用 powershell 设置以下三个值

CPU limit=20%
CPU limit Action= Killw3p
Cpu Limit Interval= 1
Run Code Online (Sandbox Code Playgroud)

我已经使用 powershell 将启动模式设置为始终运行。

set-itemproperty IIS:\AppPools\AddressBroker.API -name startMode -value AlwaysRunning
Run Code Online (Sandbox Code Playgroud)

我尝试过类似下面的方法,但不起作用。

set-itemproperty IIS:\AppPools\AddressBroker.API -name CPU -value Limit=20%
Run Code Online (Sandbox Code Playgroud)

iis powershell windows-server-2012

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

使用 Python boto3 对大量存储桶进行 S3 默认服务器端加密

您好,我正在尝试使用 python boto3 脚本在帐户中的所有存储桶上打开默认 s3 加密,请参见下文。

import boto3
from botocore.exceptions import ClientError


s3 = boto3.client('s3')

response = s3.list_buckets()

for bucket in response['Buckets']:
    enc = s3.get_bucket_encryption(Bucket=bucket['Name'])
    s3.put_bucket_encryption(
        Bucket=bucket['Name'],
        ServerSideEncryptionConfiguration={
          'Rules': [
            {
                'ApplyServerSideEncryptionByDefault': {
                    'SSEAlgorithm': 'AES256'
                }
            },
          ]
        }
    )
Run Code Online (Sandbox Code Playgroud)

但我正在努力解决我的代码无法正常工作的问题

给出错误

  File "apply.py", line 10, in <module>
    enc = s3.get_bucket_encryption(Bucket=bucket['Name'])
  File "/Users/hhaqqani/Library/Python/2.7/lib/python/site-packages/botocore/client.py", line 272, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/hhaqqani/Library/Python/2.7/lib/python/site-packages/botocore/client.py", line 576, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (ServerSideEncryptionConfigurationNotFoundError) when calling the GetBucketEncryption operation: The …
Run Code Online (Sandbox Code Playgroud)

python command-line-interface amazon-s3 amazon-web-services boto3

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