.Net Framework 4.6.1+版本的Winform程序开启Web服务,支持Http webapi

news/2024/4/26 13:10:03/文章来源:https://blog.csdn.net/iml6yu/article/details/130362320

Winform程序开启Web服务

  • 背景
  • 思路
    • 方法1
    • 方法2
    • 方法3(本文使用的方法)
  • 实现
    • 在winform程序中引入几个nuget包
    • 新建一个Startup类(叫什么名字都行)
    • 修改Program文件
    • 创建controller
  • 运行效果(打开浏览器,输入如下地址)
    • 修改地址,调用get方法引起winform变动
  • winform中的message方法
  • 关于配置端口和地址请查看文章
  • 完整代码下载

背景

在很久以前为了满足需求,已经开发了一款winform程序,并且是4.6.1版本的,如今为了和第三方对接,需要在这个winform上提供WebAPI的接口。因为第三方的程序是一份没有源码的程序。

思路

方法1

  • 网上有很多自写web服务的功能,个人觉得过于麻烦,而且还要考虑一些路由规则什么的,太难了

方法2

  • 使用iis或者nginx提供服务,一个web程序和一个winform程序实现通信,需要做两个程序,还要交互,麻烦

方法3(本文使用的方法)

考虑4.6.1 版本刚好支持了netcore,所以可以将kestrel服务集成到winform中,直接提供webapi服务

实现

在winform程序中引入几个nuget包

Microsoft.AspNetCore  Version="2.1.7"
Microsoft.AspNetCore.Mvc  Version="2.1.3"

在使用nuget引入的时候会将关联的全部引入进来,完整的packages.config文件如下

<?xml version="1.0" encoding="utf-8"?>
<packages><package id="Microsoft.AspNetCore" version="2.1.7" targetFramework="net461" /><package id="Microsoft.AspNetCore.Antiforgery" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Authentication.Abstractions" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Authentication.Core" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Authorization" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Authorization.Policy" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Connections.Abstractions" version="2.1.3" targetFramework="net461" /><package id="Microsoft.AspNetCore.Cors" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Cryptography.Internal" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.DataProtection" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.DataProtection.Abstractions" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Diagnostics" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Diagnostics.Abstractions" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.HostFiltering" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Hosting" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Hosting.Abstractions" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Hosting.Server.Abstractions" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Html.Abstractions" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Http" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Http.Abstractions" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Http.Extensions" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Http.Features" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.HttpOverrides" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.HttpsPolicy" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.JsonPatch" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Localization" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Mvc" version="2.1.3" targetFramework="net461" /><package id="Microsoft.AspNetCore.Mvc.Abstractions" version="2.1.3" targetFramework="net461" /><package id="Microsoft.AspNetCore.Mvc.ApiExplorer" version="2.1.3" targetFramework="net461" /><package id="Microsoft.AspNetCore.Mvc.Core" version="2.1.3" targetFramework="net461" /><package id="Microsoft.AspNetCore.Mvc.Cors" version="2.1.3" targetFramework="net461" /><package id="Microsoft.AspNetCore.Mvc.DataAnnotations" version="2.1.3" targetFramework="net461" /><package id="Microsoft.AspNetCore.Mvc.Formatters.Json" version="2.1.3" targetFramework="net461" /><package id="Microsoft.AspNetCore.Mvc.Localization" version="2.1.3" targetFramework="net461" /><package id="Microsoft.AspNetCore.Mvc.Razor" version="2.1.3" targetFramework="net461" /><package id="Microsoft.AspNetCore.Mvc.Razor.Extensions" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Mvc.RazorPages" version="2.1.3" targetFramework="net461" /><package id="Microsoft.AspNetCore.Mvc.TagHelpers" version="2.1.3" targetFramework="net461" /><package id="Microsoft.AspNetCore.Mvc.ViewFeatures" version="2.1.3" targetFramework="net461" /><package id="Microsoft.AspNetCore.Razor" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Razor.Design" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Razor.Language" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Razor.Runtime" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.ResponseCaching.Abstractions" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Routing" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Routing.Abstractions" version="2.1.1" targetFramework="net461" /><package id="Microsoft.AspNetCore.Server.IISIntegration" version="2.1.7" targetFramework="net461" /><package id="Microsoft.AspNetCore.Server.Kestrel" version="2.1.3" targetFramework="net461" /><package id="Microsoft.AspNetCore.Server.Kestrel.Core" version="2.1.3" targetFramework="net461" /><package id="Microsoft.AspNetCore.Server.Kestrel.Https" version="2.1.3" targetFramework="net461" /><package id="Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions" version="2.1.3" targetFramework="net461" /><package id="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" version="2.1.3" targetFramework="net461" /><package id="Microsoft.AspNetCore.WebUtilities" version="2.1.1" targetFramework="net461" /><package id="Microsoft.CodeAnalysis.Analyzers" version="1.1.0" targetFramework="net461" /><package id="Microsoft.CodeAnalysis.Common" version="2.8.0" targetFramework="net461" /><package id="Microsoft.CodeAnalysis.CSharp" version="2.8.0" targetFramework="net461" /><package id="Microsoft.CodeAnalysis.Razor" version="2.1.1" targetFramework="net461" /><package id="Microsoft.CSharp" version="4.5.0" targetFramework="net461" /><package id="Microsoft.DiaSymReader.Native" version="1.7.0" targetFramework="net461" /><package id="Microsoft.DotNet.PlatformAbstractions" version="2.1.0" targetFramework="net461" /><package id="Microsoft.Extensions.Caching.Abstractions" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.Caching.Memory" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.Configuration" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.Configuration.Abstractions" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.Configuration.Binder" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.Configuration.CommandLine" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.Configuration.EnvironmentVariables" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.Configuration.FileExtensions" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.Configuration.Json" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.Configuration.UserSecrets" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.DependencyInjection" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.DependencyModel" version="2.1.0" targetFramework="net461" /><package id="Microsoft.Extensions.FileProviders.Abstractions" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.FileProviders.Composite" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.FileProviders.Physical" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.FileSystemGlobbing" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.Hosting.Abstractions" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.Localization" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.Localization.Abstractions" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.Logging" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.Logging.Abstractions" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.Logging.Configuration" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.Logging.Console" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.Logging.Debug" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.ObjectPool" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.Options" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.Options.ConfigurationExtensions" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.Primitives" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Extensions.WebEncoders" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Net.Http.Headers" version="2.1.1" targetFramework="net461" /><package id="Microsoft.Win32.Registry" version="4.5.0" targetFramework="net461" /><package id="Newtonsoft.Json" version="11.0.2" targetFramework="net461" /><package id="Newtonsoft.Json.Bson" version="1.0.1" targetFramework="net461" /><package id="System.AppContext" version="4.3.0" targetFramework="net461" /><package id="System.Buffers" version="4.5.0" targetFramework="net461" /><package id="System.Collections" version="4.3.0" targetFramework="net461" /><package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net461" /><package id="System.Collections.Immutable" version="1.5.0" targetFramework="net461" /><package id="System.ComponentModel.Annotations" version="4.5.0" targetFramework="net461" /><package id="System.Console" version="4.3.0" targetFramework="net461" /><package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net461" /><package id="System.Diagnostics.DiagnosticSource" version="4.5.1" targetFramework="net461" /><package id="System.Diagnostics.FileVersionInfo" version="4.3.0" targetFramework="net461" /><package id="System.Diagnostics.StackTrace" version="4.3.0" targetFramework="net461" /><package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net461" /><package id="System.Dynamic.Runtime" version="4.3.0" targetFramework="net461" /><package id="System.Globalization" version="4.3.0" targetFramework="net461" /><package id="System.IO.Compression" version="4.3.0" targetFramework="net461" /><package id="System.IO.FileSystem" version="4.3.0" targetFramework="net461" /><package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net461" /><package id="System.IO.Pipelines" version="4.5.3" targetFramework="net461" /><package id="System.Linq" version="4.3.0" targetFramework="net461" /><package id="System.Linq.Expressions" version="4.3.0" targetFramework="net461" /><package id="System.Memory" version="4.5.2" targetFramework="net461" /><package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" /><package id="System.Reflection" version="4.3.0" targetFramework="net461" /><package id="System.Reflection.Metadata" version="1.6.0" targetFramework="net461" /><package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net461" /><package id="System.Runtime" version="4.3.0" targetFramework="net461" /><package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net461" /><package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net461" /><package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net461" /><package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net461" /><package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net461" /><package id="System.Security.AccessControl" version="4.5.0" targetFramework="net461" /><package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net461" /><package id="System.Security.Cryptography.Cng" version="4.5.0" targetFramework="net461" /><package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" /><package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" /><package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net461" /><package id="System.Security.Cryptography.Xml" version="4.5.0" targetFramework="net461" /><package id="System.Security.Permissions" version="4.5.0" targetFramework="net461" /><package id="System.Security.Principal.Windows" version="4.5.1" targetFramework="net461" /><package id="System.Text.Encoding" version="4.3.0" targetFramework="net461" /><package id="System.Text.Encoding.CodePages" version="4.3.0" targetFramework="net461" /><package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net461" /><package id="System.Text.Encodings.Web" version="4.5.0" targetFramework="net461" /><package id="System.Threading" version="4.3.0" targetFramework="net461" /><package id="System.Threading.Tasks" version="4.3.0" targetFramework="net461" /><package id="System.Threading.Tasks.Extensions" version="4.5.1" targetFramework="net461" /><package id="System.Threading.Tasks.Parallel" version="4.3.0" targetFramework="net461" /><package id="System.Threading.Thread" version="4.3.0" targetFramework="net461" /><package id="System.ValueTuple" version="4.3.0" targetFramework="net461" /><package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net461" /><package id="System.Xml.XDocument" version="4.3.0" targetFramework="net461" /><package id="System.Xml.XmlDocument" version="4.3.0" targetFramework="net461" /><package id="System.Xml.XPath" version="4.3.0" targetFramework="net461" /><package id="System.Xml.XPath.XDocument" version="4.3.0" targetFramework="net461" />
</packages>

新建一个Startup类(叫什么名字都行)

代码如下

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;namespace 测试一个winform
{public class Startup{public Startup(IConfiguration configuration){Configuration = configuration;}public IConfiguration Configuration { get; }// This method gets called by the runtime. Use this method to add services to the container.public void ConfigureServices(IServiceCollection services){services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);}// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.public void Configure(IApplicationBuilder app, IHostingEnvironment env){if (env.IsDevelopment()){app.UseDeveloperExceptionPage();}else{app.UseHsts();}app.UseHttpsRedirection();app.UseMvc();}}
}

修改Program文件

增加一个启动web的方法,并且在main函数中将方法启动
为了在后面能够调用form1,所以我还将form1的对象改成了静态的,代码如下

using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;namespace 测试一个winform
{internal static class Program{//声明一个静态的public static Form1 mainForm;/// <summary>/// 应用程序的主入口点。/// </summary>[STAThread]static void Main(){//启动Task.Run(() => { CreateWebHostBuilder(new string[] { }).Build().Run(); }); Application.EnableVisualStyles();Application.SetCompatibleTextRenderingDefault(false);mainForm = new Form1();Application.Run(mainForm);}//新增加的代码public static IWebHostBuilder CreateWebHostBuilder(string[] args){return WebHost.CreateDefaultBuilder(args).UseUrls("http://0.0.0.0:7001", "https://0.0.0.0:7002").UseStartup<Startup>();}}
}

创建controller

文件结构如下
在这里插入图片描述

代码内容如下

using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using 测试一个winform;namespace 测试一个winform集成web.Controllers
{[Route("api/[controller]")][ApiController]public class ValuesController : ControllerBase{// GET api/values[HttpGet]public ActionResult<IEnumerable<string>> Get(){return new string[] { "value1", "value2" };}// GET api/values/5[HttpGet("{id}")]public ActionResult<string> Get(int id){Program.mainForm.Message(id.ToString());return "value";} }
}

运行效果(打开浏览器,输入如下地址)

在这里插入图片描述

修改地址,调用get方法引起winform变动

在这里插入图片描述

winform中的message方法

public void Message(string message){//MessageBox.Show(message);this.Invoke(new Action(() => { button1.Text = message; }));}

关于配置端口和地址请查看文章

https://blog.csdn.net/iml6yu/article/details/100692488

https://blog.csdn.net/iml6yu/article/details/100692488

完整代码下载

https://download.csdn.net/download/iml6yu/87726309

如果无法下载可以 QQ和我说 (复制下面给内容到浏览器地址栏,按下回车 tencent://message/?uin=646007589&Site=&Menu=yes

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.luyixian.cn/news_show_103263.aspx

如若内容造成侵权/违法违规/事实不符,请联系dt猫网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

ThinkPHP模型操作上

ThinkPHP模型操作上 前言模型一、创建模型二、模型操作 总结 前言 在mvc架构中&#xff0c;模型的解释是写逻辑代码的地方&#xff0c;其实还可以这样理解&#xff0c;就是一串操作写在一个模型类中&#xff0c;就是你要完成某一项功能&#xff0c;将这个功能的代码写在一个mod…

记录-使用双token实现无感刷新,前后端详细代码

这里给大家分享我在网上总结出来的一些知识&#xff0c;希望对大家有所帮助 前言 近期写的一个项目使用双token实现无感刷新。最后做了一些总结&#xff0c;本文详细介绍了实现流程&#xff0c;前后端详细代码。前端使用了Vue3Vite&#xff0c;主要是axios封装&#xff0c;服务…

(栈和队列) 232. 用栈实现队列 ——【Leetcode每日一题】

❓232. 用栈实现队列 难度&#xff1a;中等 请你仅使用两个栈实现先入先出队列。队列应当支持一般队列支持的所有操作&#xff08;push、pop、peek、empty&#xff09;&#xff1a; 实现 MyQueue 类&#xff1a; void push(int x) 将元素 x 推到队列的末尾int pop() 从队列…

策略模式——时势造影响

● 策略模式介绍 在软件开发中常常遇到这样的情况&#xff1a;实现某一个功能可以有多种算法或者策略&#xff0c;我们根据实际情况选择不同的算法或者策略来完成该功能。例如&#xff0c;排序算法&#xff0c;可以使用插入排序、归并排序、冒泡排序。 针对这种情况&#xff0c…

Pytorch的CNN,RNNLSTM

CNN 拿二维卷积举例&#xff0c;我们先来看参数 卷积的基本原理&#xff0c;默认你已经知道了&#xff0c;然后我们来解释pytorch的各个参数&#xff0c;以及其背后的计算过程。 首先我们先来看卷积过后图片的形状的计算&#xff1a; 参数&#xff1a; kernel_size &#xff…

Android 动画—补间动画

帧动画是通过连续播放图片来模拟动画效果&#xff0c;而补间动画开发者只需指定动画开始&#xff0c;以及动画结束"关键帧"&#xff0c;而动画变化的"中间帧"则由系统计算并补齐&#xff01; 1.补间动画的分类和Interpolator Andoird所支持的补间动画效果…

electron+vue3全家桶+vite项目搭建【14】electron多窗口,多语言切换不同步更新问题

文章目录 引入问题演示补充逻辑注意封装缓存工具类补充状态管理调整多语言初始化调整多语言切换组件 解决方案思路整理渲染进程监听语言切换主进程创建多语言切换处理语言切换组件通知主进程语言切换 最终实现效果演示 引入 我们之前在这篇文章中集成了 多语言切换&#xff0c…

【数据挖掘与商务智能决策】第十三章 数据降维之PCA 主成分分析

13.1.2 PCA主成分分析代码实现 1.二维空间降维Python代码实现 import numpy as np X np.array([[1, 1], [2, 2], [3, 3]]) Xarray([[1, 1],[2, 2],[3, 3]])# 也可以通过pandas库来构造数据&#xff0c;效果一样 import pandas as pd X pd.DataFrame([[1, 1], [2, 2], [3, 3…

数字北京城,航行在联通2000M的“大运河”

前故宫博物院院长单霁翔&#xff0c;在《大运河漂来紫禁城》一书中提到过&#xff0c;紫禁城里的石材、木材&#xff0c;甚至每一块砖&#xff0c;都是通过大运河&#xff0c;跋山涉水来到北京的。某种程度上说&#xff0c;北京城的繁荣与这条纵跨南北的“中华大动脉”密不可分…

AntdesignVue 局部全屏后Message、Select 、Modal、Date等组件不显示问题解决方案(最终版)

1、对this.$message.....这种的消息提示组件解决方案如下 在main.js中全局配置消息提示 //单独引用需修改的元素 import { message } from ant-design-vue message.config({maxCount: 1,getContainer:() > document.getElementById(showBigModal) || document.body //父组件…

Android-实现一个登录页面(kotlin)

准备工作 首先&#xff0c;确保你已经安装了 Android Studio。如果还没有安装&#xff0c;请访问 Android Studio 官网 下载并安装。 前提条件 - 安装并配置好 Android Studio Android Studio Electric Eel | 2022.1.1 Patch 2 Build #AI-221.6008.13.2211.9619390, built …

C++(继承中)

目录&#xff1a; 1.基类和派生类对象赋值转换 2.派生类当中的6个默认成员函数 --------------------------------------------------------------------------------------------------------------------------- 派生类对象可以赋值给 基类的对象/基类的指针/基类的引用&am…

Java每日一练(20230425)

目录 1. 乘积最大子数组 &#x1f31f;&#x1f31f; 2. 插入区间 &#x1f31f;&#x1f31f; 3. 删除有序数组中的重复项 II &#x1f31f;&#x1f31f; &#x1f31f; 每日一练刷题专栏 &#x1f31f; Golang每日一练 专栏 Python每日一练 专栏 C/C每日一练 专栏…

CSGO搬砖,每天1-2小时,23年最强副业非它莫属(内附操作流程)

自从我学会了CSGO搬运&#xff0c;我发现生活也有了不小的改变&#xff0c;多了一份收入&#xff0c;生活质量也就提高了一份。 其实刚接触CSGO&#xff0c;我压根就不相信这么能挣钱&#xff0c;因为在印象中&#xff0c;游戏供玩家娱乐竞技的&#xff0c;作为我这种技术渣渣…

直播系统开发中如何优化API接口的并发

概述 在直播系统中&#xff0c;API接口并发的优化是非常重要的&#xff0c;因为它可以提高系统的稳定性和性能。本文将介绍一些优化API接口并发的方法。 理解API接口并发 在直播系统中&#xff0c;API接口是用于处理客户端请求的关键组件。由于许多客户端同时连接到系统&…

HTTP1.1(十二)Cookie的格式与约束

一 Cookie的格式与约束 ① Cookies是什么 1) cookie是我们在前端编程中经常使用的概念2) 使用cookie利用浏览器帮助我们保存客户的相关状态信息,保存用户已经做了什么事情3) 重点和难点[1]、cookie的工作原理[2]、cookie的限制是什么[3]、session又是怎样与cookie关联起来 …

90年三本程序员,8年5跳,年薪4万变92万……

很多时候&#xff0c;虽然跳槽可能带来降薪的结果&#xff0c;但依然有很多人认为跳槽可以涨薪。近日&#xff0c;看到一则帖子。 发帖的楼主表示&#xff0c;自己8年5跳&#xff0c;年薪4万到92万&#xff0c;现在环沪上海各一套房&#xff0c;再干5年码农&#xff0c;就可以…

【Vue】学习笔记-初始化脚手架

初始化脚手架 初始化脚手架说明具体步骤脚手架文件结构 初始化脚手架 说明 Vue脚手架是vue官方提供的标准化开发工具&#xff08;开发平台&#xff09;最新版本是4.x文档Vue CLI 具体步骤 如果下载缓慢请配置npm淘宝镜像 npm config set registry http://registry.npm.taoba…

【移动端网页布局】流式布局案例 ② ( 实现顶部固定定位提示栏 | 布局元素百分比设置 | 列表样式设置 | 默认样式设置 )

文章目录 一、样式测量及核心要点1、样式测量2、高度设定3、列表项设置4、设置每个元素的百分比宽度5、设置图像宽度 二、核心代码编写1、HTML 标签结构2、CSS 样式3、展示效果 三、完整代码示例1、HTML 标签结构2、CSS 样式3、展示效果 一、样式测量及核心要点 1、样式测量 京…

【ChatGPT】如何让 ChatGPT 不再频繁报错,获取更加稳定的体验?

文章目录 一、问题描述二、方案1&#xff1a;使用 OpenAI API Key 来访问 ChatGPT三、方案2&#xff1a;安装 Chrome 插件3.1 介绍3.2 安装步骤3.2.1 插件 & 脚本安装3.2.2 解读功能 一、问题描述 最近一段时间&#xff0c;相信大家都发现了 ChatGPT 一个问题&#xff0c;…