Opening Default document on IIS (HTML With WebAPI)
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?
1
|
I'm not sure if this is the best way to achieve this, I just edited my RouteConfig.cs such this:
Now I can get http://domain.com works perfectly! I'd love If anyone have a best way to achieve this! |
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 字符编码:从基础到乱码解决
2012-12-11 WCF客户端引用带有 int bool 类型的方法时,会自动加上一个Specified参数的 解决方法 Web Reference for a WCF Service has Extra “IdSpecified” Parameter -摘自网络
2012-12-11 WebService 设置成自定义实体 Web References 文件夹下 Reference.map下面的InvoiceDetailsViewModel.datasource文件里的 GenericObjectDataSource