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 ) ,只能适用于局域 ...
随机推荐
- 快速了解MongoDB
简介 MongoDB是一款为广泛的现代应用程序设计的高性能.可扩展.分布式数据库系统.MongoDB可用于不同规模大小的组织,为那些对系统低延迟.高吞吐量以及可持续性有很高要求的应用提供稳定关键的服务 ...
- Oracle数据库中 =:和 :=
=:应该相当于 a = :b 表明b是个绑定变量,需要执行时进行变量绑定. 变量绑定:变量绑定是指在sql语句的条件中使用变量而不是常量.比如shared pool里有两条sql语句,select * ...
- python之提升程序性能的解决方案
Python在性能方面不卓越,但是使用一些小技巧,可以提高Python程序的性能,避免不必要的资源浪费. 1. 使用局部变量 尽可能使用局部变量替代全局变量,可以是程序易于维护并且有助于提高性能节约成 ...
- Miniconda安装 虚拟环境创建 与包管理
安装python 之前安装python包,导致了python里面的包不兼容,用管理工具卸载也下载不掉,重新安装也安装不上,没有办法只能卸掉python重装. 安装Anaconda Anaconda指的 ...
- likely和unlikely是如何对代码的优化?
在执行if判断时,可以使用GCC提供了__builtin_expect对代码进行优化,可以提高代码的运行速度,参考GCC手册的"3.10 Options That Cont ...
- linux设备驱动程序——将驱动程序编译进内核
linux驱动程序--将驱动程序编译进内核 模块的加载 通常来说,在驱动模块的开发阶段,一般是将模块编译成.ko文件,再使用 sudo insmod module.ko 或者 depmod -a mo ...
- Linux操作系统之用户权限,重定向,文件管理
文件的权限 ls -al ----->隐藏文件会以 .号开头 ls -ld :显示目录自身属性 ls -i 显示文件的索引号----每个文件都有一个对应的号码 ls -r 逆序显示 dr-xr ...
- Jenkins中如何实现debug配置
java -jar -Xmx512m -Dfile.encoding=UTF-8 -server -XX:-OmitStackTraceInFastThrow -server -agentlib:jd ...
- 【转】Linux虚拟网络基础——tap
原文:https://blog.csdn.net/chengqiuming/article/details/80071073 ------------------------------------- ...
- MySQL 中的默认数据库介绍
MySQL 中的默认数据库介绍:https://dataedo.com/kb/databases/mysql/default-databases-schemas 默认数据库 官方文档 informat ...