Microsoft.Owin 使用 文件服务
<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 使用 文件服务的更多相关文章
- Microsoft.Owin.Security.OAuth搭建OAuth2.0授权服务端
Microsoft.Owin.Security.OAuth搭建OAuth2.0授权服务端 目录 前言 OAuth2.0简介 授权模式 (SimpleSSO示例) 使用Microsoft.Owin.Se ...
- SimpleSSO:使用Microsoft.Owin.Security.OAuth搭建OAuth2.0授权服务端
目录 前言 OAuth2.0简介 授权模式 (SimpleSSO示例) 使用Microsoft.Owin.Security.SimpleSSO模拟OpenID认证 通过authorization co ...
- windows service承载的web api宿主搭建(Microsoft.Owin+service)
今天突然想起改良一下以前搭建的“windows service承载的web api”服务,以前也是直接引用的类库,没有使用nuget包,时隔几年应该很旧版本了吧.所以本次把需要nuget获取的包记录一 ...
- 中国版Azure 文件服务
中国版Azure 文件服务预览版在2015年1月13日已经上线,文件存储使用标准SMB 2.1协议为应用程序提供共享存储. 当我们的虚拟机连接到文件共享后就可以像使用本地共享文件夹一样来读取和写入文件 ...
- 扩展 Microsoft.Owin.Security
微软在 OWIN 框架中对 OAuth 认证的支持非常好, 使用现有的 OWIN 中间件可以做到: 使用 Microsoft.Owin.Security.OAuth 搭建自己的 OAuth2 服务端, ...
- 外网远程顶级域名连接群晖的WebDAV文件服务映射盘符
外网远程顶级域名连接群晖的WebDAV文件服务映射盘符 https://www.cnblogs.com/delphixx/p/11846546.html 电子文件管理规范 1.手机拍照截屏 ...
- Microsoft.Owin.Hosting 实现启动webapp.dll
Microsoft.Owin.Hosting 下面是 asp.net core 实现 using System;using System.Collections.Generic;using Syste ...
- Microsoft Azure 负载平衡服务
Microsoft Azure 为在其中托管的虚拟机(IaaS) 和云服务(PaaS) 提供负载平衡服务.负载平衡支持应用程序伸缩,并且提供应用程序故障恢复以及其他优势. 可以通过以下方式访问负 ...
- Linux 文件服务---------- nfs Server
Linux 文件服务nfs (Network file system)#网络文件系统 ---> 远程文件调用samba #文件共享(unix /linux /windows ) ,只能适用于局域 ...
随机推荐
- Golang中文乱码问题
在学习golang读取文件的过程中,遇到中文显示乱码的问题!golang没有自带的编解码包,因此需要借助第三方包 解决方法: 引入第三发转码包:git clone https://github.com ...
- Hive之累计报表生成
Hive之累计报表生成 1. 原始数据 u01 2019/1/21 5u02 2019/1/23 6u03 2019/1/22 8u04 2019/1/20 3u01 2019/1/23 6u01 2 ...
- 浅谈Python设计模式 - 适配器模式
声明:本系列文章主要参考<精通Python设计模式>一书,并且参考一些资料,结合自己的一些看法来总结而来. 从本篇便开始介绍结构型设计模式,而适配器设计模式便是该类设计模式的一种,那么什么 ...
- Redis中的LFU算法
在Redis中的LRU算法文中说到,LRU有一个缺陷,在如下情况下: ~~~~~A~~~~~A~~~~~A~~~~A~~~~~A~~~~~A~~| ~~B~~B~~B~~B~~B~~B~~B~~B~~ ...
- C++编写动态库(.DLL)给C#调用方法
1.在头文件中按照如下格式编写函数申明 extern "C" __declspec(dllexport) double __stdcall Add(double a, double ...
- SQL注入(2)
SQL注入id title content time author select * from news where id = 1; select 1,2,3,4,5,6 from table ...
- Codeforces B. Bad Luck Island(概率dp)
题目描述: Bad Luck Island time limit per test 2 seconds memory limit per test 256 megabytes input standa ...
- php抽象工厂模式(Abstract factory pattern)
练代码 <?php interface Button { public function render(); } interface GUIFactory { public function c ...
- WPF系列 —— 控件添加依赖属性
依赖属性的概念,用途 ,如何新建与使用.本文用做一个自定义TimePicker控件来演示WPF的依赖属性的简单应用. 先上TimePicker的一个效果图. 概念 和 用途:依赖属性是对传统.net ...
- ie下的透明度,用滤镜filter:alpha
.box{ width:100px; height:100px; background-color:#000; filter:alpha(Opacity=50); opacity: 0.5; }