Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Web API routes.IgnoreRoute问题_C#_Asp.net Web Api - Fatal编程技术网

C# Web API routes.IgnoreRoute问题

C# Web API routes.IgnoreRoute问题,c#,asp.net-web-api,C#,Asp.net Web Api,在Web API中,我已生成html文件并将其保存在“Exports”目录中,现在我希望用户通过以下url访问此html文件: 我使用了这些选项,但似乎没有任何效果: //1 routes.IgnoreRoute("Exports/{resource}.html"); //2 routes.IgnoreRoute("Exports/{*file}"); //3 routes.IgnoreRout

在Web API中,我已生成html文件并将其保存在“Exports”目录中,现在我希望用户通过以下url访问此html文件:

我使用了这些选项,但似乎没有任何效果:

        //1
        routes.IgnoreRoute("Exports/{resource}.html");

        //2
        routes.IgnoreRoute("Exports/{*file}");

        //3
        routes.IgnoreRoute("{file}.html");
当我访问Url时,出现以下错误:

消息:“未找到与请求URI“”匹配的HTTP资源。”,

MessageDetail:“未找到与名为“Exports”的控制器匹配的类型。”

您是否缺少Begging上的“api”?IIrc您需要在域名后指定URL的完整路径。在你的例子中,
api/Exports/{resource}.html
api/Exports{*file}
api/{file}.html
。你不是在begging上缺少了“api”吗?IIrc你需要在域名之后为URL指定完整的路径。在你的例子中,
api/Exports/{resource}.html
api/Exports{*file}
api/{file}.html
。你不是在begging上缺少了“api”吗?IIrc你需要在域名之后为URL指定完整的路径。在您的例子中,
api/Exports/{resource}.html
api/Exports{*file}
api/{file}.html