Background Recently, I needed to connect a domain name with the public IP of residential broadband, which led to a series of issues. Note: Machines within the country without registration cannot provide external services! http://www.gov.cn/gongbao/content/2005…

2022年10月18日 0条评论 58点热度 4人点赞 痴者工良 阅读全文

背景 最近要将域名跟家庭宽带的公网 IP 打通,出现了一系列的问题。 注意:国内未经备案的机器,不能对外提供服务! http://www.gov.cn/gongbao/content/2005/content_93018.htm 非经营性互联网信息服务备案管理办法 在中华人民共和国境内提供非经营性互联网信息服务,应当依法履行备案手续。 未经备案,不得在中华人民共和国境内从事非经营性互联网信息服务。 在国内的家庭宽带中,80/443 端口是不开放的,但是 caddy 需要使用这两个端口才能访问,如果设置其他端口,会导…

2022年10月18日 0条评论 11516点热度 4人点赞 痴者工良 阅读全文

Background The initial approach adopted was to develop using Maui + Blazor, utilizing the Blazor UI framework, which has high community popularity. However, during the development process, there were numerous pitfalls with Maui and the Blazor UI framework. The…

2022年10月17日 0条评论 84点热度 2人点赞 痴者工良 阅读全文

背景 最先采用的是 Maui + Blazor 开发,使用社区热度比较高的 Blazor UI 框架。 可是开发进行过程中, Maui 巨多坑,Blazor UI 框架也是巨多坑,使用 Blazor UI 写的页面和样式,过不了设计师和产品经理的是法眼。 最终决定使用原生前端结合,生成静态内容放到 Maui 中,然后将两者结合起来打包发布。 先搞前端 对于前端来说,按照正常的开发模式就行,不对对前端的代码产生污染。 可以使用 VS 创建前端项目,将其放到解决方案中,也可以单独创建一个目录,将前端代码放到里面。 创建…

2022年10月17日 0条评论 2460点热度 2人点赞 痴者工良 阅读全文

bool IsDefine<T1, T2>(T2 t) where T1 : Enum where T2 : Enum { var value = Unsafe.As<T2, T1>(ref t); var array = Enum.GetValues(typeof(T1)); return (Array.BinarySearch(array, value) >= 0); } public static class EnumTool<T1, T2> where T1 : E…

2022年10月13日 0条评论 1775点热度 0人点赞 痴者工良 阅读全文

bool IsDefine<T1, T2>(T2 t) where T1 : Enum where T2 : Enum { var value = Unsafe.As<T2, T1>(ref t); var array = Enum.GetValues(typeof(T1)); return (Array.BinarySearch(array, value) >= 0); } public static class EnumTool<T1, T2> where T1 : E…

2022年10月13日 0条评论 1765点热度 0人点赞 痴者工良 阅读全文

In projects using partial classes, such as Razor, Blazor, WPF, etc., the compilation will generate .g.cs files. However, if there are issues that prevent successful compilation, and examining the source code does not reveal any errors, one can begin outputting…

2022年10月13日 0条评论 1907点热度 0人点赞 痴者工良 阅读全文

在项目使用分部类,如 Razor、Blazor、Wpf 等项目中,编译会生成 .g.cs 文件,但是因为出现了问题,不能编译成功,查看源代码,找不出错误,只能开始输出 .g.cs ,查看文件进行检查。 <PropertyGroup> <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles> </PropertyGroup> https://stackoverflow.com/questions/7117…

2022年10月13日 0条评论 1901点热度 0人点赞 痴者工良 阅读全文

Fast speed and good performance through DNS. dig ANY +short @resolver2.opendns.com myip.opendns.com dig ANY +short @resolver2.opendns.com myip.opendns.com dig ANY +short @ns1-1.akamaitech.net ANY whoami.akamai.net [......] 继续阅读

2022年10月12日 0条评论 66点热度 0人点赞 痴者工良 阅读全文

通过 DNS 方式,速度快,性能好。 dig ANY +short @resolver2.opendns.com myip.opendns.com dig ANY +short @resolver2.opendns.com myip.opendns.com dig ANY +short @ns1-1.akamaitech.net ANY whoami.akamai.net [......] 继续阅读

2022年10月12日 0条评论 1764点热度 0人点赞 痴者工良 阅读全文

// json => Dictionary static Dictionary<string, string> Read(string jsonData) { var reader = new Utf8JsonReader(Encoding.Default.GetBytes(jsonData), _jsonReaderOptions); var map = new Dictionary<string, string>(); BuildMap(r[......]继续阅读

2022年10月10日 0条评论 114点热度 0人点赞 痴者工良 阅读全文

// json => Dictionary static Dictionary<string, string> Read(string jsonData) { var reader = new Utf8JsonReader(Encoding.Default.GetBytes(jsonData), _jsonReaderOptions); var map = new Dictionary<string, string>(); BuildMap(r[......]继续阅读

2022年10月10日 0条评论 2140点热度 0人点赞 痴者工良 阅读全文

private static void RunPowershellScript(string scriptFile) { ProcessStartInfo ps = new ProcessStartInfo(@"powershell.exe", scriptFile) { RedirectStandardOutput = true }; //ps.CreateNoWindow = true; var proc = Process.Start(ps); proc.OutputDataReceive…

2022年10月9日 0条评论 128点热度 0人点赞 痴者工良 阅读全文

private static void RunPowershellScript(string scriptFile) { ProcessStartInfo ps = new ProcessStartInfo(@"powershell.exe",scriptFile) { RedirectStandardOutput = true }; //ps.CreateNoWindow = true; var proc = Process.Start(ps); proc.OutputDataReceived += (s, e)…

2022年10月9日 0条评论 2258点热度 0人点赞 痴者工良 阅读全文

using System.Resources; var assembly = typeof(Program).Assembly; ResourceManager resourceManager = new ResourceManager("update.Properties.Resources", assembly); var host = resourceManager.GetString("host"); You can retrieve a list of resour…

2022年10月8日 0条评论 96点热度 0人点赞 痴者工良 阅读全文

using System.Resources; var assembly = typeof(Program).Assembly; ResourceManager resourceManager = new ResourceManager("update.Properties.Resources", assembly); var host = resourceManager.GetString("host"); 可以通过 typeof(Program).Assembly.GetManifestResourceName…

2022年10月8日 0条评论 1858点热度 0人点赞 痴者工良 阅读全文

Project publish parameters: dotnet publish -c Release -r win-x64 -p:PublishProfile=FolderProfile --no-self-contained dotnet publish -c Release -r win-x64 -p:PublishProfile=FolderProfile -p:PublishReadyToRun=true -p:PublishTrimmed=true --self-contained false En…

2022年10月8日 0条评论 100点热度 2人点赞 痴者工良 阅读全文

项目发布参数: dotnet publish -c Release -r win-x64 -p:PublishProfile=FolderProfile --no-self-contained dotnet publish -c Release -r win-x64 -p:PublishProfile=FolderProfile -p:PublishReadyToRun=true -p:PublishTrimmed=true --self-contained false 开启裁剪: 关闭反射: <IlcDis…

2022年10月8日 0条评论 2802点热度 2人点赞 痴者工良 阅读全文

ASP.NET Core Response.Body is by default an HttpResponseStream, which is characterized by allowing writes only in append mode, and it cannot be read or modified. Therefore, the fundamental method is to replace the HttpResponseStream. You can set up a middlewar…

2022年9月30日 0条评论 916点热度 0人点赞 痴者工良 阅读全文

ASP.NET Core Response.Body 默认是 HttpResponseStream,其主要特征是只能追加写,不能读取也不能修改。 所以最根本方法是替换 HttpResponseStream。 随便设置一个中间件,或者将 HttpContext 拿出来,定义变量 context。 替换 Body: var responseOriginalBody = context.Response.Body; var memStream = new MemoryStream(); context.Response.…

2022年9月30日 0条评论 3026点热度 0人点赞 痴者工良 阅读全文
1131415161754