OWIN启动方法如何获取网站的基本URL? [英] How can an OWIN Startup method get the base URL of the web site?

查看:91
本文介绍了OWIN启动方法如何获取网站的基本URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OWIN启动方法如何获取网站的基本URL?

How can an OWIN startup method get the base URL of the web site?

我正在尝试编写在使用IISExpress进行调试,通过自托管以及在IIS下进行单元测试时可以使用的代码.

I'm trying to write code that will work when debugging with IISExpress, unit testing with self hosting and under IIS.

在进行自我托管时,我可以在IAppBuilder.Properties ["host.Addresses"]中找到此信息,但是在IISExpress(未选中IIS)下运行时,该信息不存在.

When self hosting, I can find this information in IAppBuilder.Properties["host.Addresses"] but, it isn't there when running under IISExpress (haven't checked IIS).

推荐答案

System.Web.VirtualPathUtility.ToAbsolute("~")

这篇关于OWIN启动方法如何获取网站的基本URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆