日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

C#語言SDK發送長內容時,報錯“Invalid URI: The Uri string is too long”

問題場景

C#語言SDK發送長內容時,報錯“Invalid URI: The Uri string is too long”。

解決方案

登錄阿里云openAPI生成調試代碼。

開啟“Common模式生成示例“開關,并填寫參數。

image

獲取到代碼后,需要將URL傳參改為Body傳參。

請參考截圖,兩處重點改動:

image

修改后代碼:

// This file is auto-generated, don't edit it. Thanks.

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;

using Tea;
using Tea.Utils;


namespace AlibabaCloud.SDK.Sample
{
    public class Sample
    {

        /**
         * 使用AK&SK初始化賬號Client
         * @return Client
         * @throws Exception
         */
        public static AlibabaCloud.OpenApiClient.Client CreateClient()
        {
            // 工程代碼泄露可能會導致 AccessKey 泄露,并威脅賬號下所有資源的安全性。以下代碼示例僅供參考。
            // 建議使用更安全的 STS 方式,更多鑒權訪問方式請參見:http://m.bestwisewords.com/document_detail/378671.html。
            AlibabaCloud.OpenApiClient.Models.Config config = new AlibabaCloud.OpenApiClient.Models.Config
            {
                // 必填,請確保代碼運行環境設置了環境變量 ALIBABA_CLOUD_ACCESS_KEY_ID。
                AccessKeyId = "xxxxxx",
                // 必填,請確保代碼運行環境設置了環境變量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
                AccessKeySecret = "xxxxxx",
            };
            // Endpoint 請參考 https://api.aliyun.com/product/Dm
            config.Endpoint = "dm.aliyuncs.com";
            return new AlibabaCloud.OpenApiClient.Client(config);
        }

        /**
         * API 相關
         * @param path params
         * @return OpenApi.Params
         */
        public static AlibabaCloud.OpenApiClient.Models.Params CreateApiInfo()
        {
            AlibabaCloud.OpenApiClient.Models.Params params_ = new AlibabaCloud.OpenApiClient.Models.Params
            {
                // 接口名稱
                Action = "SingleSendMail",
                // 接口版本
                Version = "2015-11-23",
                // 接口協議
                Protocol = "HTTPS",
                // 接口 HTTP 方法
                Method = "POST",
                AuthType = "AK",
                Style = "RPC",
                // 接口 PATH
                Pathname = "/",
                // 接口請求體內容格式
                ReqBodyType = "formdata",
                // 接口響應體內容格式
                BodyType = "json",
            };
            return params_;
        }

        public static void Main(string[] args)
        {
            AlibabaCloud.OpenApiClient.Client client = CreateClient();
            AlibabaCloud.OpenApiClient.Models.Params params_ = CreateApiInfo();
            // query params
            Dictionary<string, object> queries = new Dictionary<string, object>() { };
            queries["AccountName"] = "xxxxxx";
            queries["AddressType"] = 1;
            queries["ReplyToAddress"] = false;
            queries["ToAddress"] = "xxxxxx";
            queries["Subject"] = "test2";
            queries["HtmlBody"] = "test長內容";
            // runtime options
            AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new AlibabaCloud.TeaUtil.Models.RuntimeOptions();
            AlibabaCloud.OpenApiClient.Models.OpenApiRequest request = new AlibabaCloud.OpenApiClient.Models.OpenApiRequest
            {
                Body = queries,
            };
            // 復制代碼運行請自行打印 API 的返回值
            // 返回值為 Map 類型,可從 Map 中獲得三類數據:響應體 body、響應頭 headers、HTTP 返回的狀態碼 statusCode。
            client.CallApi(params_, request, runtime);
        }


    }
}