首页 > 其他分享 >IIS 屏蔽Help页面和Swagger

IIS 屏蔽Help页面和Swagger

时间:2024-09-09 15:02:46浏览次数:5  
标签:Web Help IIS System 屏蔽 using Swagger

1、MVC屏蔽 HelP 页面暴露API接口

方法:找到目录下的 Areas\HelpPage\Views\Help

的Index.cshtml 注释如代码中

@using System.Web.Http
@using System.Web.Http.Controllers
@using System.Web.Http.Description
@using System.Collections.ObjectModel
@using Interface.Service.Areas.HelpPage.Models
@model Collection<ApiDescription>

@{
    ViewBag.Title = "ASP.NET Web API Help Page";

    // Group APIs by controller
    ILookup<HttpControllerDescriptor, ApiDescription> apiGroups = Model.ToLookup(api => api.ActionDescriptor.ControllerDescriptor);
}

<link type="text/css" href="~/Areas/HelpPage/HelpPage.css" rel="stylesheet" />
<header class="help-page">
    <div class="content-wrapper">
        <div class="float-left">
            <h1>@ViewBag.Title</h1>
        </div>
    </div>
</header>
<!-- 
<div id="body" class="help-page">
    <section class="featured">
        <div class="content-wrapper">
            <h2>Introduction</h2>
            <p>
                Provide a general description of your APIs here.
            </p>
        </div>
    </section>
    <section class="content-wrapper main-content clear-fix">
        @foreach (var group in apiGroups)
        {
            @Html.DisplayFor(m => group, "ApiGroup")
        }
    </section>
</div>
-->
View Code

2、屏蔽WEBAPI接口中的Swagger

找到IIS站点的请求筛选的Url 项,设置如下:

 

标签:Web,Help,IIS,System,屏蔽,using,Swagger
From: https://www.cnblogs.com/stroll/p/18404594

相关文章

  • 设置swagger版本
     builder.Services.AddSwaggerGen(option=>{typeof(ApiVersion).GetEnumNames().ToList().ForEach(version=>{option.SwaggerDoc(version,newOpenApiInfo(){Title="xxxxAPI文档",Version=ver......
  • 速解《黑神话:悟空》dbghelp.dll缺失难题:即刻修复游戏故障攻略
    遇到《黑神话:悟空》提示dbghelp.dll文件缺失的问题,可以按照以下步骤尝试解决:1.重新安装DirectX:dbghelp.dll是MicrosoftDirectX的一部分,有时通过重新安装DirectX可以解决这个问题。访问微软官方网站下载并安装最新版本的DirectX。DirectX修复工具最新版(点击即可下载)https://......
  • SAPIEN PowerShell HelpWriter crack
    SAPIENPowerShellHelpWritercrackKeyFeaturesofSAPIENPowerShellHelpWriter:SwiftPerformancewithCachedDataandMulti-threadedCodeVersatileExplorationofLocalandRemoteMachinesAdvancedSearchOptionsandPowerfulFilters......
  • Parse error: syntax error, unexpected 'function' (T_FUNCTION) in core\function
    遇到 Parseerror:syntaxerror,unexpected'function'(T_FUNCTION) 的错误,通常是因为PHP代码中存在语法错误。这种错误通常发生在PHP版本不兼容的情况下,或者代码本身有语法问题。分析错误错误信息指出在\core\function\helper.php 文件的第80行出现了语法错误。......
  • 使用 Android Lua Helper 在VSCODE中调试安卓Lua应用
    一、VSCODE与AndroidLuaHelper的功能特点VisualStudioCode(VSCODE)是一款功能强大的代码编辑器,它以其高度可定制的界面、强大的扩展生态系统、流畅的性能表现以及对众多编程语言的天然支持而备受开发者青睐。在众多的开发场景中,VSCODE都展现出了卓越的性能和灵活性。Lua......
  • 【springboot】使用swagger生成接口文档
    1.添加依赖<dependency><groupId>org.springdoc</groupId><artifactId>springdoc-openapi-starter-webmvc-ui</artifactId><version>2.6.0</version></dependency>       这里我老是添加不上......
  • 告别CAD运行难题:一键解决dbghelp.dll错误的方法
    当你在使用CAD(计算机辅助设计)软件时遇到dbghelp.dll错误,这可能会导致软件无法正常运行或频繁崩溃。不过,你不必过于担心,因为这个问题通常可以通过几种方法来解决。以下是一些简单而有效的方法,旨在帮助你一键解决dbghelp.dll错误。方法一:使用系统文件检查器(SFC)Windows操作系统......
  • MyRequestsHelper
    importrequestsimporttimeclassStateCodeError(Exception):"""状态码异常"""passclassContentError(Exception):"""内容异常"""passclassRequestHelper:"""未使用代理......
  • MysqlHelper
    #来源:https://blog.csdn.net/YZL40514131/article/details/127170427frompymysqlimport*classMysqlHelper:#todo数据库连接参数,可以定义多个,比如conn_params1,conn_params2,用于连接多个数据库,在类实例化时指定conn_params={'host':'localhost',......
  • IIS相关错误报错汇总整理及解决方案
    解决方案400BadRequest:检查请求是否包含错误的信息或格式。401Unauthorized:确认是否已经进行了身份验证。403Forbidden:检查是否有足够的权限访问资源。404NotFound:确认请求的URL是否正确,资源是否存在。500InternalServerError:检查服务器日志,寻找错误信息。503Ser......