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. (转)Overview : Writing Scripts in C# 使用C#书写脚本

    Apart from syntax, there are some differences when writing scripts in C# or Boo. Most notable are: 除 ...

  2. webpack 编译ES6插件babel-loader

    1.安装babel-loader 参考:http://babeljs.io/docs/setup/#installation 进入项目目录执行安装命名: npm install --save-dev ...

  3. JAR,WAR,EAR区别

    JAR WAR EAR 英文 Java Archive file Web Archive file Enterprise Archive file 包含内容 class.properties文件,是文 ...

  4. 改变maven父子项目视图为树状

    完毕

  5. iOS-仿京东6位密码支付输入框

    概述 用于安全支付的密码支付输入框. 详细 代码下载:http://www.demodashi.com/demo/10709.html 开发需求中有时候我们需要用于安全支付的功能, 需要设置APP钱包 ...

  6. ZOJ 2314 有上下界的网络流

    problemCode=2314">点击打开链接 题意:给定m条边和n个节点.每条边最少的流量和最多的流量.保证每一个节点的出入流量和相等,问能够形成吗,能够则输出每条边的流量 思路: ...

  7. Android网络开发之Socket通信

    HTTP通信中Client发送的每次请求都需要Server回送响应,在请求结束后,Client会主动释放连接.从建立连接到隔壁连接的过程成为一次连接.要保持Client程序的在线状态,需要不断地向Se ...

  8. Linux下PHP5.5编译参数详解

    一.配置参数 ./configure --prefix=/data/app/php --with-config-file-path=/etc --with-mysql=/usr\ --with-mys ...

  9. ios block常见的错误(二)——循环引用

    这篇博文继续block的常见错误——循环引用. 循环引用是很多初学者不能察觉的,其产生的原因,是block中的代码会对对象进行强引用. 读者请阅读示例代码1,并思考示例代码1所创建的对象能否被正常销毁 ...

  10. Java任务调度框架Quartz

    转自:http://blog.csdn.net/yuebinghaoyuan/article/details/9045471  介绍  Quartz is a full-featured, open ...