添加引用:
<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. Servlet , GenericServlet和HttpServlet

    Servlet是一套规范,表现为一套接口,留给开发人员去实现,Servlet接口定义如下(附加servlet-api source来查看源码) 其中init方法被Servlet容器调用,servlet ...

  2. 爬虫之selenium模块;无头浏览器的使用

    一,案例 爬取站长素材中的图片:http://sc.chinaz.com/tupian/gudianmeinvtupian.html import requests from lxml import ...

  3. layui 自定义字体图标 扩展

    layui的图标取自于阿里巴巴的矢量图标库 Iconfont,同样的,这篇教程也是基于Iconfont进行扩展. 第一步,通过浏览器打开 http://iconfont.cn/ ,访问阿里巴巴矢量图标 ...

  4. 定时任务工具Linux crontab命令详解

    crontab:定时任务的守护进程,精确到分,设计秒的我们一般写脚本  -->相当于闹钟        日志文件:  ll /var/log/cron*        编辑文件: vim /et ...

  5. Netbackup常用命令--bprestore

    bprestore bprestore – 从 NetBackup 服务器还原文件 大纲 bprestore [-A | -B | -rb] [-K] [-l | -H | -y] [-r] [-T] ...

  6. Win 8\10系统安装软件报错

    一.问题 Win 8\10系统由于权限管理严格,右键管理员运行安装软件也会出现各种错误: 进度条走到20%闪退,报程序停止运行等等等等 二.解决思路 先确定软件路径安装在D盘(非系统盘). 开启超级管 ...

  7. SpringCloud2.0 Hystrix Ribbon 基于Ribbon实现断路器

    原文:https://www.cnblogs.com/songlu/p/9949203.html 1.启动[服务中心]集群,工程名:springcloud-eureka-server 参考 Sprin ...

  8. django项目后台权限管理功能。

    对后台管理员进行分角色,分类别管理,每个管理员登录账号后只显示自己负责的权限范围. 创建后台管理数据库 models.py文件内 # 管理员表 class Superuser(models.Model ...

  9. C++ - STL - map的基础操作

    STL - map常用方法 map简述 map是STL的一个关联容器,它提供一对一(其中第一个可以称为关键字,每个关键字只能在map中出现一次,第二个可能称为该关键字的值)的数据处理能力,其作用类似于 ...

  10. django小知识(1)

    聚合查询 关键字:aggregate from django.db.models import Max,Min,Count,Sum,Avg 分组查询 关键字:annotate 1.最简单的规律 mod ...