奎文营销型网站建设企业如何找网络公司做网站

张小明 2026/1/10 18:55:46
奎文营销型网站建设,企业如何找网络公司做网站,网站开发设计心得及体会,网站建设培训教程 新手入门到精通一直觉得很好的一个组件#xff0c;网上介绍少得可怜#xff0c;没办法#xff0c;只有自己爬官网了#xff0c;又是对照git又是看doc文档#xff0c;总算是玩明白了#xff0c;现在完全抛弃那个谁谁谁了。因人喜好各取所长吧先来官方参考地址#xff1a;https://learn.…一直觉得很好的一个组件网上介绍少得可怜没办法只有自己爬官网了又是对照git又是看doc文档总算是玩明白了现在完全抛弃那个谁谁谁了。因人喜好各取所长吧先来官方参考地址https://learn.microsoft.com/zh-cn/aspnet/core/fundamentals/openapi/include-metadata?viewaspnetcore-9.0tabsminimal-apis这是scalar的.net 集成文档地址https://guides.scalar.com/scalar/scalar-api-references/integrations/net-aspnet-core/integrationgithub地址https://github.com/scalar/scalar先放个图诱惑一下集成了很多主题还可以自定主题留给前端去玩吧01一、简单使用1.建立一个API项目最小mvc都可2.引用包dotnet add package Scalar.AspNetCore 当前版本2.9.0dotnet add package Microsoft.AspNetCore.OpenApi当前版本10.03.添加引用using Scalar.AspNetCore;4.添加配置在Program.cs中添加下面配置复制代码builder.Services.AddOpenApi();if (app.Environment.IsDevelopment()){app.MapOpenApi();app.MapScalarApiReference();}复制代码现在运行一下看看localhost:xxxx/scalar是不是看到列出漂亮的界面了二、基本配置1.自定义路由不想使用/salar可以换成自己的地址app.MapScalarApiReference(/api-docs);app.MapScalarApiReference(/docs);2.多文当或版本控制复制代码// Chain multiple documentsapp.MapScalarApiReference(options {options.AddDocument(v1, Production API, api/v1/openapi.json).AddDocument(v2-beta, Beta API, api/v2-beta/openapi.json, isDefault: true).AddDocument(internal, Internal API, internal/openapi.json);});复制代码isDefault: true是默认打开的页面3.自定义文档的默认调试语言app.MapScalarApiReference(options {options.WithDefaultHttpClient(ScalarTarget.CSharp, ScalarClient.HttpClient);});02它对应右边窗口的语言基本上都支持java,php,rust,py,swift三、高级配置之前的老版本使用的硬编码option加配置2.9.0以后在界面右上角菜单栏上出现了一个编辑配置功能03根据自己的喜好调试编辑完配置文件后可以复制到文件中单独保存真是太贴心了复制代码{title: Aquxa API Documentation,slug: aquxa-api-documentation,hideClientButton: true,servers: [{url: http://localhost:5215,description: Development server}],showSidebar: true,showToolbar: localhost,//这里特别说明一下编辑完后不想出现这个菜单栏就在这里可以关闭showToolbar: neveroperationTitleSource: summary,theme: solarized,//主题可以自己选喜欢哪个选哪个_integration: dotnet,persistAuth: false,telemetry: true,layout: modern,isEditable: false,isLoading: false,hideModels: true,documentDownloadType: both,hideTestRequestButton: false,hideSearch: false,showOperationId: false,hideDarkModeToggle: false,favicon: favicon.svg,withDefaultFonts: true,defaultOpenAllTags: false,expandAllModelSections: true,expandAllResponses: true,orderSchemaPropertiesBy: alpha,orderRequiredPropertiesFirst: true,url: http://localhost:5215/openapi/v1.json}复制代码PS这里特别说明一下编辑完后不想出现这个菜单栏就在这里可以关闭showToolbar: never得到这个文件保存到wwwroot/js/scalar-config.js注意一定要保存到能访问的静态目录里并在program.cs添加静态目录的配置app.UseStaticFiles(). //这个要放在scalar配置的前面不然访问不到添加配置文件加载.WithJavaScriptConfiguration(/js/scalar-config.js)04这里费了好大的劲查官方看代码因为官方文档还是老文档只是简单的概括了一下。最后整出来了四、文档的编辑使用最重要的还是API文档编辑其实它完全用的标准的OpenApi只要参考这个表就可以完全配置了05复制代码[ApiController][Route(api/[controller])][ApiExplorerSettings(GroupName v1)][Tags(Admin)] // 为整个控制器添加标签public class AdminController : ControllerBase{[HttpPost(reload-cache)]public IActionResult ReloadCache(){// 模拟重新加载缓存的操作return Ok(Cache reloaded successfully);}[HttpGet(stats)]public IActionResult GetStats(){return Ok(new { Users 100, Requests 1000 });}}复制代码下面说一下常用的特性1.API分组[ApiExplorerSettings]这个比较熟悉它可以分组分版本当你分好版本后[ApiExplorerSettings(GroupName v1)]/[ApiExplorerSettings(GroupName v2)]会在scalar中左上角可以选择当然你也可以把它做为组来用06如果有不想显示的API也可以用[ApiExplorerSettings(IgnoreApi true)]来排除显示[HttpGet(/private)][ApiExplorerSettings(IgnoreApi true)]public IActionResult PrivateEndpoint() {return Ok(This is a private endpoint);}2.API分类[Tags]分类的API会归档在一起方便查询这样看起来没有那么乱了复制代码[Tags([Admin, OtherAPI])][HttpGet(attributes)]public IResult Attributes(){return Results.Ok(Hello world!);}复制代码073.描述复制代码[EndpointSummary(OtherApi)][EndpointDescription(这是一个公开接口无需认证)][HttpGet(attributes)]public IResult Attributes(){return Results.Ok(Hello world!);}复制代码084.过滤不想显示的接口可以用上面说的[ApiExplorerSettings(IgnoreApi true)]来关闭还有一个就是根目录如果在配置文件中有MapGet可以使用.ExcludeFromDescription();排除显示123// 默认打开首页app.MapGet(/, () Hangfire 服务运行中。访问 /hangfire 查看仪表盘访问 /docs 查看API文档).ExcludeFromDescription();//可以使用.ExcludeFromDescription();排除显示更多编辑文档就看这里吧https://learn.microsoft.com/zh-cn/aspnet/core/fundamentals/openapi/include-metadata?viewaspnetcore-9.0tabscontrollers五、认证授权这里就使用自己的授权就可以这里就偷懒找AI完成了。参考部分都有备注复制代码using Scalar.AspNetCore;using Microsoft.AspNetCore.Authentication;using Microsoft.Extensions.Options;using System.Security.Claims;using System.Text.Encodings.Web;using Microsoft.AspNetCore.Mvc;using MyWebApi; // 添加对WeatherForecast的引用var builder WebApplication.CreateBuilder(args);// Add services to the container.// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapibuilder.Services.AddOpenApi(v1);builder.Services.AddOpenApi(v2);// 添加控制器服务builder.Services.AddControllers();// 添加身份验证服务builder.Services.AddAuthentication(BasicAuthentication).AddSchemeAuthenticationSchemeOptions, BasicAuthenticationHandler(BasicAuthentication, null);// 添加授权服务builder.Services.AddAuthorization(options {options.AddPolicy(ScalarAccess, policy policy.RequireAuthenticatedUser());});// 配置服务器URL避免端口冲突builder.WebHost.UseUrls(http://localhost:5215);var app builder.Build();// Configure static file middleware to serve the JavaScript config fileapp.UseStaticFiles();// 添加身份验证和授权中间件app.UseAuthentication();app.UseAuthorization();// Configure the HTTP request pipeline.if (app.Environment.IsDevelopment()){app.MapOpenApi();// Add Scalar for API management with JavaScript configuration and authorizationapp.MapScalarApiReference(/scalar, options {options.WithTitle(MyWebApi).WithJavaScriptConfiguration(/js/scalar-config.js).AddDocument(v1, Aquxa API Documentation,isDefault: true).AddDocument(v2, Beta API);}).RequireAuthorization(ScalarAccess); // 应用授权策略}// 添加控制器路由app.MapControllers();app.Run();// Basic Authentication Handlerpublic class BasicAuthenticationHandler : AuthenticationHandlerAuthenticationSchemeOptions{public BasicAuthenticationHandler(IOptionsMonitorAuthenticationSchemeOptions options,ILoggerFactory logger,UrlEncoder encoder): base(options, logger, encoder){}protected override async TaskAuthenticateResult HandleAuthenticateAsync(){// 检查是否有Authorization头if (!Request.Headers.ContainsKey(Authorization))return AuthenticateResult.NoResult();try{// 解析Basic认证头var authHeader Request.Headers[Authorization].ToString();if (!authHeader.StartsWith(Basic ))return AuthenticateResult.NoResult();var encodedCredentials authHeader.Substring(Basic .Length).Trim();var decodedCredentials System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(encodedCredentials));var credentials decodedCredentials.Split(:, 2);var username credentials[0];var password credentials[1];// 验证用户名和密码这里使用硬编码实际应用中应从配置或数据库获取if (username admin password password123){var claims new[] { new Claim(ClaimTypes.Name, username) };var identity new ClaimsIdentity(claims, Scheme.Name);var principal new ClaimsPrincipal(identity);var ticket new AuthenticationTicket(principal, Scheme.Name);return AuthenticateResult.Success(ticket);}return AuthenticateResult.Fail(Invalid username or password);}catch{return AuthenticateResult.Fail(Invalid Authorization Header);}}protected override async Task HandleChallengeAsync(AuthenticationProperties properties){// 发送WWW-Authenticate头以触发浏览器的认证对话框Response.Headers[WWW-Authenticate] Basic realm\Scalar API Documentation\;await base.HandleChallengeAsync(properties);}}复制代码
版权声明:本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

企业网站模板建设九江网站建设张旭

10 个继续教育开题报告工具,AI 写作助手推荐 在时间与压力中寻找出口 继续教育的学员们,往往面临着一个共同的难题——如何在繁重的工作任务与学业压力之间找到平衡。尤其是在撰写开题报告、文献综述或毕业论文时,时间总是显得格外紧张。许多…

张小明 2025/12/29 6:59:21 网站建设

营销型网站建设msggwordpress主题升级

第一章:手机AI性能提升90%?Open-AutoGLM优化秘籍首次公开近年来,移动端大模型推理的性能瓶颈成为制约AI应用落地的关键因素。Open-AutoGLM 作为开源的轻量化推理框架,通过动态图优化与算子融合技术,首次在主流安卓设备…

张小明 2026/1/10 14:13:41 网站建设

山东省建筑住房和城乡建设厅网站文创产品网站

PKHeX自动化合法性引擎:5大核心技术深度解析与实战应用 【免费下载链接】PKHeX-Plugins Plugins for PKHeX 项目地址: https://gitcode.com/gh_mirrors/pk/PKHeX-Plugins 在宝可梦数据管理领域,AutoLegalityMod作为PKHeX的智能合法性引擎&#xf…

张小明 2026/1/8 23:17:19 网站建设

建设本地端网站首页官网

CVPR ABCNet:CNN与Transformer的完美融合论文原文 :https://arxiv.org/abs/2303.10321代码:https://github.com/PANPEIWEN/ABC即插即用代码仓库:https://github.com/AITricks/AITricks1️⃣ 核心思想:局部与全局的强强…

张小明 2025/12/28 3:41:15 网站建设

网站正在建设中怎么办样板网站

一.背景 LangChain Agent 按需使用 Skill(技能),是指智能代理根据任务场景的具体需求,动态选择、调用并组合所需的技能模块(如数据查询、逻辑推理、工具调用、自然语言生成等),而非一次性加载所有技能。这一模式的诞生,根植于大语言模型应用从 “通用能力展示” 走向 “…

张小明 2025/12/28 5:07:53 网站建设

渐江建工水利水电建设有限公司网站惠州手机网站商城建设

ComfyUI黑洞能源站:从混沌中提取AI创造力的工程化实践 在AIGC内容爆炸式增长的今天,我们正面临一个看似矛盾的现象:生成模型的能力越来越强,但对它们的控制却似乎愈发困难。点击“生成”按钮后,得到的可能是一张惊艳的…

张小明 2025/12/31 3:52:44 网站建设