添加引用:
<package id="Microsoft.Owin" version="4.0.1" targetFramework="net461" />
<package id="Microsoft.Owin.FileSystems" version="4.0.1" targetFramework="net461" />
<package id="Microsoft.Owin.Hosting" version="4.0.2" targetFramework="net461" />
<package id="Microsoft.Owin.StaticFiles" version="4.0.1" targetFramework="net461" />
 
appBuilder.UseFileServer(new FileServerOptions()
{
RequestPath = PathString.Empty,
FileSystem = new PhysicalFileSystem(@".\")
}); appBuilder.UseStaticFiles("/Views");
appBuilder.UseStaticFiles("/Scripts");
appBuilder.UseStaticFiles("/js");
appBuilder.UseStaticFiles("/Content"); // Configure Web API for self-host.
HttpConfiguration config = new HttpConfiguration(); // Enable attribute based routing
// http://www.asp.net/web-api/overview/web-api-routing-and-actions/attribute-routing-in-web-api-2
config.MapHttpAttributeRoutes(); // Remove the XML formatter
config.Formatters.Remove(config.Formatters.XmlFormatter); config.Routes.MapHttpRoute(
name: "AfterglowAPI",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
); appBuilder.UseWebApi(config);
}

效果:

参考:https://chris.59north.com/post/What-is-OWIN-and-what-is-it-doing-in-my-new-ASPNET-MVC-project

https://mirkomaggioni.com/2016/09/11/owin-middleware-for-static-files/

https://odetocode.com/blogs/scott/archive/2014/02/10/building-a-simple-file-server-with-owin-and-katana.aspx

https://github.com/aspnet/AspNetKatana/tree/dev/src

https://beginor.github.io/2015/12/28/owin-static-file-middleware.html

http://johnatten.com/2015/01/04/asp-net-understanding-owin-katana-and-the-middleware-pipeline/

Microsoft.Owin 使用 文件服务的更多相关文章

  1. Microsoft.Owin.Security.OAuth搭建OAuth2.0授权服务端

    Microsoft.Owin.Security.OAuth搭建OAuth2.0授权服务端 目录 前言 OAuth2.0简介 授权模式 (SimpleSSO示例) 使用Microsoft.Owin.Se ...

  2. SimpleSSO:使用Microsoft.Owin.Security.OAuth搭建OAuth2.0授权服务端

    目录 前言 OAuth2.0简介 授权模式 (SimpleSSO示例) 使用Microsoft.Owin.Security.SimpleSSO模拟OpenID认证 通过authorization co ...

  3. windows service承载的web api宿主搭建(Microsoft.Owin+service)

    今天突然想起改良一下以前搭建的“windows service承载的web api”服务,以前也是直接引用的类库,没有使用nuget包,时隔几年应该很旧版本了吧.所以本次把需要nuget获取的包记录一 ...

  4. 中国版Azure 文件服务

    中国版Azure 文件服务预览版在2015年1月13日已经上线,文件存储使用标准SMB 2.1协议为应用程序提供共享存储. 当我们的虚拟机连接到文件共享后就可以像使用本地共享文件夹一样来读取和写入文件 ...

  5. 扩展 Microsoft.Owin.Security

    微软在 OWIN 框架中对 OAuth 认证的支持非常好, 使用现有的 OWIN 中间件可以做到: 使用 Microsoft.Owin.Security.OAuth 搭建自己的 OAuth2 服务端, ...

  6. 外网远程顶级域名连接群晖的WebDAV文件服务映射盘符

       外网远程顶级域名连接群晖的WebDAV文件服务映射盘符 https://www.cnblogs.com/delphixx/p/11846546.html 电子文件管理规范   1.手机拍照截屏 ...

  7. Microsoft.Owin.Hosting 实现启动webapp.dll

    Microsoft.Owin.Hosting 下面是 asp.net core 实现 using System;using System.Collections.Generic;using Syste ...

  8. Microsoft Azure 负载平衡服务

     Microsoft Azure 为在其中托管的虚拟机(IaaS) 和云服务(PaaS) 提供负载平衡服务.负载平衡支持应用程序伸缩,并且提供应用程序故障恢复以及其他优势. 可以通过以下方式访问负 ...

  9. Linux 文件服务---------- nfs Server

    Linux 文件服务nfs (Network file system)#网络文件系统 ---> 远程文件调用samba #文件共享(unix /linux /windows ) ,只能适用于局域 ...

随机推荐

  1. Redux 进阶之 react-redux 和 redux-thunk 的应用

    1. react-redux React-Redux 是 Redux 的官方 React 绑定库. React-Redux 能够使你的React组件从Redux store中读取数据,并且向 stor ...

  2. pandas 之 数据清洗-缺失值

    Abstract During the course fo doing data analysis and modeling, a significant amount of time is spen ...

  3. Shell 编程 基础

    本篇主要写一些shell脚本的基础知识,编程规范. 第一个shell脚本 [root@localhost ~]# vim first.sh #!/bin/bash # This is first Sh ...

  4. 使用APICloud创建一个webapp项目

    1.在APICloud官网注册,下载APICloud Studio并解压.(这里我选择的是APICloud Studio,还可以选择其他的开发工具的APICloud插件如Sublime,Webstor ...

  5. springboot2.1.3 本地加载jar包+打包载入本地jar

    项目已springboot为主,有时候我们需要引入的jar包并非maven公共库中存在(这里不谈私自搭建私库),那我们能否像普通的工程一样,导入自己手动添加的jar包文件呢? 答案是肯定的,来,一起往 ...

  6. 生产环境碰到系统CPU飙高和频繁GC系统反应慢,你要怎么排查?(转)

    处理过线上问题的同学基本上都会遇到系统突然运行缓慢,CPU 100%,以及Full GC次数过多的问题.当然,这些问题的最终导致的直观现象就是系统运行缓慢,并且有大量的报警.本文主要针对系统运行缓慢这 ...

  7. 用Java的大整数类BigInteger来实现大整数的一些运算

    关于BigInteger的构造函数,一般会用到两个: BigInteger(String val); //将指定字符串转换为十进制表示形式: BigInteger(String val,int rad ...

  8. Django 的 cbv

    Django 的 cbv 正如我们了解到的,Django 写视图函数有两种写法:cbv 和 fbv.cbv 提倡使用类来写,fbv 使用函数来 写.当然为了代码的重复行,官方更推荐使用 cbv. 写 ...

  9. JVM 性能调优工具

    jdk自带的工具,在macOs系统中的目录位置(jdk具体版本位置要替换):/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Ho ...

  10. signed Unsigned Compare

    // signUnsignCompare.cpp : Defines the entry point for the console application. // #include "st ...