Question:

I've a deployed ASP.NET Web API with a website on the same folder that consume it.

When I type the URL on the Browser such as http://domain.com/ it returns a 404, but if I typehttp://domain.com/index.html it works!

I wanna know if there's a way to configure it on Web API route, define a default route for it, redirecting to my http://domain.com/index.html when I type http://domain.com/

I've tried ti put this on Web.Config without success:

<defaultDocument enabled="true">
<files>
<add value="/index.html" />
</files>
</defaultDocument>

Also, I set up my IIS to only accept index.html default document. no success =/

Any ideas?

I'm not sure if this is the best way to achieve this, I just edited my RouteConfig.cs such this:

public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute(
name: "Default",
url: "index.html"
);
}
}

Now I can get http://domain.com works perfectly!

I'd love If anyone have a best way to achieve this!

Opening Default document on IIS (HTML With WebAPI)的更多相关文章

  1. Default Document <defaultDocument> IIS中的默认页面

    https://docs.microsoft.com/en-us/iis/configuration/system.webserver/defaultdocument/index Default do ...

  2. 使用delphi+intraweb进行微信开发2—intraweb以.net方式发布(以asp.net mvc4模式部署)在IIS(.net虚拟主机)上

    在第一讲使用delphi+intraweb进行微信开发1--微信平台接入中我们编写了一个简单的微信接口程序,这个程序我是用Stand Alone Server / Service 方式编译的程序,并且 ...

  3. Umbraco(4)-Outputting the Document Type Properties(翻译文档)

    翻译原文地址:http://www.ncloud.hk/%E6%8A%80%E6%9C%AF%E5%88%86%E4%BA%AB/umbraco4outputting-the-document-typ ...

  4. 搭建Windows IIS(Internet Information Server)服务器

    1.找到 控制面板\程序 点击 “打开或关闭Windows功能” ,全部选上“Internet信息服务”,这里可能要等几分钟. 2.完成之后你打开C盘,在他的根目录下多出一个inetpub文件夹里面有 ...

  5. AntDeploy发布前端项目到IIS(脱离vs单独使用)

    AntDeploy AntDeploy是一款开源的一键发布部署工具,目的是代替重复性的发布动作,提高部署效率 1.一键部署iis 2.一键部署windows服务 3.一键部署到Docker 4.支持增 ...

  6. 让外界可以访问电脑上的网站的几种方式——花生壳,域名,IIS(待)

    前话: 每次“养大“一个网站,都有种骄傲地想秀给朋友们看的冲动. 之前可能是困于电脑,实在不方便. 现在,不用克制了! 该秀就秀,能装逼就装逼. 养大孩子就该拉出来秀秀,见见世面. 正题:这次实习,我 ...

  7. JAVA编程思想(第四版)学习笔记----4.8 switch(知识点已更新)

    switch语句和if-else语句不同,switch语句可以有多个可能的执行路径.在第四版java编程思想介绍switch语句的语法格式时写到: switch (integral-selector) ...

  8. JS 原生JS 判断滚动条滑动到底部(兼容苹果safari)

    ListenerScoller () { var pageIndex = 1; var startX, startY; document.addEventListener('touchstart',f ...

  9. SSD-2(代码部分介绍)

    single shot multibox detectior tensorflow 代码 一.SSD重要参数设置 在ssd_vgg_300.py文件中初始化重要的网络参数,主要有用于生成默认框的特征层 ...

随机推荐

  1. 我所认识的PCA算法的princomp函数与经历 (基于matlab)

    我接触princomp函数,主要是因为实验室的项目需要,所以我一接触的时候就希望快点学会怎么用. 项目中需要利用PCA算法对大量数据进行降维. 简介:主成分分析 ( Principal Compone ...

  2. easyui combotree不让父级选中

    easyui combotree不让父级选中? <ul id="combotree"></ul> $(function () { $("#comb ...

  3. 微信公众号开发之如何使用JSSDK

    微信开发交流群:148540125 欢迎留言.转发.打赏 系列文章参考地址 极速开发微信公众号 项目源码参考地址 点我点我--欢迎Start 查看公众号是否有使用JSSDK的权限 服务号.订阅号可以通 ...

  4. mavern安装方法

    Installation Instructions Maven is a Java tool, so you must have Java installed in order to proceed. ...

  5. MySQL Event计划任务刷慢日志

    前言 最近在尝试一个日志系统graylog来收集mysql的慢查询日志提,供后续的分析.监控和报警等.测试步骤已经到日志已成功收集到graylog,测试时需要刷一些慢查询日志出来.为了刷比较多的日志和 ...

  6. Android遍历获取指定目录的文件(转)

    // 获取当前目录下所有的mp4文件 public static Vector<String> GetVideoFileName(String fileAbsolutePath) { Ve ...

  7. 实现锁死的有滚动条的div的表格(datagird)

    JS框架使用Jquery 最终效果: 代码结构: 代码: <HEAD><TITLE>new document</TITLE> <META name=Gener ...

  8. 使用openssl进行证书格式转换

    各类证书由于存储的内容不同(如是否包含公钥/私钥是否加密存储/单一证书或多证书等).采用编 码不同(DER/BASE64).标准不同(如PEM/PKCS),所以尽管X.509标准规定了证书内容规范,但 ...

  9. Linux下动态共享库加载时的搜索路径详解

    对动态库的实际应用还不太熟悉的读者可能曾经遇到过类似“error while loading shared libraries”这样的错误,这是典型的因为需要的动态库不在动态链接器ld.so的搜索路径 ...

  10. ELK日志分析平台搭建全过程

    一.使用背景 当生产环境有很多服务器.很多业务模块的日志需要每时每刻查看时 二.环境 系统:centos 6.5 JDK:1.8 Elasticsearch-5.0.0 Logstash-5.0.0 ...