360doc--修行的嘟嘟的文章 360doc--修行的嘟嘟的文章 http://m.ahfyzs.com/rssperson/1039473.aspx 360doc (http://m.ahfyzs.com) zh-cn 360doc--個(gè)人圖書館 Redis分布式鎖 http://m.ahfyzs.com/content/24/1120/16/1039473_1139848209.shtml 2024/11/20 16:13:28
.net core 設(shè)置跨越 http://m.ahfyzs.com/content/24/1105/14/1039473_1138554625.shtml 2024/11/5 14:33:17
.net core 設(shè)置跨越Startup Configure中設(shè)置跨越app.UseCors(builder =>{ builder.AllowAnyHeader() .AllowAnyMethod() .SetIsOriginAllowed((url) => true) //Access-Control-Allow-Origin .AllowCredentials(); //Access-Control-Allow-Credentials});在控制器或操作方法上應(yīng)用 CORS 策略:你可以在整個(gè)應(yīng)用級(jí)別應(yīng)用 CORS 策略(如上面的示例所示),也可以在特定的控制器或操作方法上應(yīng)用。
108條可見人性城府之深!(收藏學(xué)習(xí)) http://m.ahfyzs.com/content/24/1024/17/242467_1137528548.shtml 2024/10/30 9:34:20
.net 兩個(gè)對(duì)象相同參數(shù)復(fù)制 http://m.ahfyzs.com/content/24/1016/14/1039473_1136708532.shtml 2024/10/16 14:14:33
RabbitMQ UI(控制臺(tái))配置死信隊(duì)列 http://m.ahfyzs.com/content/24/0815/09/1039473_1131414679.shtml 2024/8/15 9:37:47
RabbitMQ UI(控制臺(tái))配置死信隊(duì)列。當(dāng)消息過期時(shí),它不會(huì)自動(dòng)進(jìn)入死信(Dead Letter)隊(duì)列,除非你專門設(shè)置了死信交換器(Dead Letter Exchange,DLX)。為了讓過期的消息進(jìn)入死信隊(duì)列,你需要做以下幾步:聲明一個(gè)死信隊(duì)列(dead-queue),并在聲明完成后,綁定死信交換機(jī)(my-dlx)和死信routing-key(比如我定義叫dlx.ttl.key)4. 為死信隊(duì)列綁定綁定死信交換機(jī)(mgcc-dlx)和死信routing-key(比如我定義叫dlx.ttl.key)
并行多線程處理 http://m.ahfyzs.com/content/24/0710/15/1039473_1128430268.shtml 2024/7/10 15:40:28
/// <param name="resultRules"></param>/// <param name="ruleList"></param>private void GetRuleList(List<Rules> resultRules, List<List<Rule>> ruleList)Rules rules = new Rules();rules.rules = ruleItem;if (rules.rules.foreach (Rule item in rules.rules)item.ruleSets = new List<RuleSet>();foreach (RuleSet set in data)
List拆分 http://m.ahfyzs.com/content/24/0708/17/1039473_1128276096.shtml 2024/7/8 17:23:38
List拆分。/// 拆分List.public static List<List<T>> SplitList(List<T> list, int chunkSize)var result = new List<List<T>>();Min(chunkSize, list.//List拆分,每次5000條。int chunkSize = 5000;List<List<Rule>> splittedLists = ListSplitter<Rule>.SplitList(list, chunkSize);foreach (var splitList in splittedLists)
.net core loger配置 http://m.ahfyzs.com/content/24/0629/12/1039473_1127429060.shtml 2024/6/29 12:15:10
<attribute name="module" layout="${var:module}" /><attribute name="node" layout="${var:node}" /><attribute name="machinename" layout="${machinename}" /><attribute name="basedir" layout="${basedir}" /><attribute name="logger" layout="${logger}" /><attribute name="processid" layout="${processid}" /></layout><target xsi:type="Console" name="console" layout="${time}|${level}|${logger}|${message}" />
.net core 使用新地址的配置文件配置 http://m.ahfyzs.com/content/24/0629/12/1039473_1127428712.shtml 2024/6/29 12:09:08
.net core 使用新地址的配置文件配置。using System;using System.using Microsoft.AspNetCore;AspNetCore.public static void Main(string[] args)CreateWebHostBuilder(args).public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>CreateDefaultBuilder(args)ConfigureAppConfiguration((context, config) =>MaxValue;
.net core 獲取request.body里面的參數(shù) http://m.ahfyzs.com/content/24/0626/17/1039473_1127207077.shtml 2024/6/26 17:30:30
.net core 獲取request.body里面的參數(shù)。由于.net 5.0 倒帶方式發(fā)生了改變,在asp.net core web api 項(xiàng)目中,框架為.NET5,啟動(dòng)倒帶方式,為 request.EnableBuffering()但是在過濾器中使用此方法時(shí)出現(xiàn)異常,request.body的長度總是為0,說明在請(qǐng)求到達(dá)過濾器時(shí)Steam已經(jīng)被讀取了。OnActionExecuting(context);var request = context.using var requestReader = new StreamReader(request.OnActionExecuted(context);
接口數(shù)據(jù)獲取方法 http://m.ahfyzs.com/content/24/0626/16/1039473_1127199392.shtml 2024/6/26 16:09:37
接口數(shù)據(jù)獲取方法。
.net core 接口防重冪等 http://m.ahfyzs.com/content/24/0625/11/1039473_1127090733.shtml 2024/6/25 11:04:44
public async Task&lt;bool&gt; AcquireLock(string resourceName, string lockValue, TimeSpan expirationTime)//public async Task&lt;bool&gt; ReleaseLock(string resourceName, string lockValue)string luaScript = $&quot;if redis.call(&#39;&#39;get&#39;&#39;, KEYS[1]) == ARGV[1] then return redis.call(&#39;&#39;del&#39;&#39;, KEYS[1]) else return 0 end&quot;;public RedisDistributedLock(string configuratio
RabbitMQ在.Net Core中應(yīng)用 http://m.ahfyzs.com/content/24/0620/17/1039473_1126711649.shtml 2024/6/20 17:28:21
RabbitMQ在.Net Core中應(yīng)用。&quot;HostName&quot;: &quot;xx.xx.xx.xx&quot;,&quot;target&quot;: &quot;message://xxx//xxx&quot;在系統(tǒng)配置要用message.xxx.xxx.Contract data = new Application.Message&lt;Application.Contract&gt; msg = new OAPlusCore.readonly ILogRecorder&lt;RabbitmqSubscriber&gt; logger;readonly RabbitmqSubscriber subscriber;ILogRecorder&lt;RabbitmqSubscriber&gt; logger,this.logger = logg
Mongdb封裝及.net core 引用 http://m.ahfyzs.com/content/24/0619/10/1039473_1126589365.shtml 2024/6/19 10:08:45
/// <param name="host">mongodb連接信息</param>/// <param name="filter">修改條件</param>/// <param name="filter">刪除的條件</param>/// <param name="filter">條件</param>/// <param name="filter">查詢條件</param>public static async Task<List<T>> FindListByPageAsync(MongdbSettings host, FilterDefinition<T> filter, int pageIndex, int pageSize, string[] field = null, SortDefinition<T> sort = null)
MongoDB Shell工具:mongosh的使用 http://m.ahfyzs.com/content/24/0618/12/1039473_1126516503.shtml 2024/6/18 12:55:10
MongoDB Shell工具:mongosh的使用。MongoDB的Shell工具mongosh是一個(gè)全功能的JavaScript和Node.js的14.x REPL與MongoDB的部署交互環(huán)境。1.2 啟動(dòng) MongoDB.因?yàn)橹笪覀兪褂胢ongosh來連接MongoDB實(shí)例,因此先要對(duì) MongoDB進(jìn)行啟動(dòng)。注意:使用該命令的時(shí)候,如果有數(shù)據(jù)庫名稱指定的數(shù)據(jù)庫則會(huì)使用該數(shù)據(jù)庫,否則將自動(dòng)創(chuàng)建名稱為所指定名稱的數(shù)據(jù)庫。db.集合名.drop() 3.4 文檔操作3.4.1 文檔的插入(1)插入單個(gè)文檔。
window下給mongodb設(shè)置用戶名和密碼 http://m.ahfyzs.com/content/24/0618/12/1039473_1126516391.shtml 2024/6/18 12:53:37
window下給mongodb設(shè)置用戶名和密碼。通過use來創(chuàng)建和切換數(shù)據(jù)庫,如果數(shù)據(jù)庫已存在就切換數(shù)據(jù)庫,如果數(shù)據(jù)庫不存在,就創(chuàng)建數(shù)據(jù)庫,如下: 展示數(shù)據(jù)庫用show dbs mongodb通過createUser來創(chuàng)建賬戶和密碼 參數(shù)說明: 數(shù)據(jù)庫用戶角色:read、readWrite;數(shù)據(jù)庫管理角色:dbAdmin、dbOwner、userAdmin;1) net stop MongoDB2) mongod --dbpath d:\mongodb\data --auth3) net start MongoDB.
MongoDBCompass 添加用戶名密碼 http://m.ahfyzs.com/content/24/0618/12/1039473_1126516092.shtml 2024/6/18 12:49:02
MongoDBCompass 添加用戶名密碼。步驟1:打開MongoDBCompass,連接到數(shù)據(jù)庫。use admin:切換到admin數(shù)據(jù)庫,如果要添加用戶名和密碼的數(shù)據(jù)庫不是admin,則需要替換成相應(yīng)的數(shù)據(jù)庫名稱。erDiagram step1 -- step2: 創(chuàng)建用戶 step2 -- step3: 添加用戶名和密碼 step3 -- step4: 驗(yàn)證用戶名和密碼流程圖。flowchart TD A[打開MongoDBCompass,連接到數(shù)據(jù)庫] --> B[創(chuàng)建用戶] B --> C[添加用戶名和密碼] C --> D[驗(yàn)證用戶名和密碼]
MongDB解決Authentication Failed導(dǎo)致的不能連接問題 http://m.ahfyzs.com/content/24/0618/11/1039473_1126508357.shtml 2024/6/18 11:06:08
嘗試敲入以下命令:db; use admin; db.auth(“admin”, “admin”)解決方法是手動(dòng)添加admin賬戶,創(chuàng)建成功后,再次db.auth(“admin”, “admin”),返回1.db.createUser( { user: "admin", pwd: "admin", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] } )Successfully added user: { "user" : "admin", "roles" : [ { "role" : "userAdminAnyDatabase", "db" : "admin" } ]}>db.auth("admin","admin")1.
MongoDB +MongoDB在.net Core中的應(yīng)用+封裝MongoDB上下文類 http://m.ahfyzs.com/content/24/0618/10/1039473_1126506282.shtml 2024/6/18 10:46:08
MongoDB +MongoDB在.net Core中的應(yīng)用+封裝MongoDB上下文類MongoDB +MongoDB在.net Core中的應(yīng)用一、什么是MongoDB.MongoDB是一個(gè)基于分布式文件存儲(chǔ)的數(shù)據(jù)庫MongoDB是一個(gè)介于關(guān)系數(shù)據(jù)庫和非關(guān)系數(shù)據(jù)庫之間的產(chǎn)品,是非關(guān)系數(shù)據(jù)庫當(dāng)中功能最豐富,最像關(guān)系數(shù)據(jù)庫的。生成一個(gè)用與存放字符串信息與所要連接的MongoDB數(shù)據(jù)庫名稱信息的類---對(duì)應(yīng)這里的信息數(shù)據(jù)是通過后面和ef上下文/dapper上下文在一起的那個(gè)類通過構(gòu)造傳來的。
nginx負(fù)載配置 http://m.ahfyzs.com/content/24/0613/14/1039473_1126090722.shtml 2024/6/13 14:28:37
nginx負(fù)載配置。#系統(tǒng)設(shè)置服務(wù)。upstream contractServer {server 11.53.104.114:8004;server 11.53.104.115:8004;#系統(tǒng)設(shè)置服務(wù)配置。server {keepalive_requests 120;#單連接請(qǐng)求上限次數(shù)。listen 8081;#監(jiān)聽端口。server_name 127.0.0.1;#監(jiān)聽地址。location / {#拒絕的ip.#允許的ip.proxy_pass http://contractServer;