bước để tái tạo lại vấn đề này:Thêm WebAPI như một đứa trẻ/ứng dụng lồng nhau trong IIS
- Bên trong IIS tạo mới .net 4 trang web (ở đây gọi là công ty mẹ). Thả một hình ảnh kiểm tra trong thư mục cho trang web này và quan sát bạn có thể yêu cầu nó thành công trong một trình duyệt
- Thêm một thư mục ảo mới HOẶC ứng dụng dưới phụ huynh trỏ đến một dự án WebAPI 2
- Cố gắng để truy cập vào API trong trình duyệt sử dụng www.path-to-parent-site.com/api/something/or/other
tôi nhận được lỗi sau:
System.Web.Routing.UrlRoutingModule does not implement IHttpHandlerFactory or IHttpHandler.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Configuration.ConfigurationErrorsException: System.Web.Routing.UrlRoutingModule does not implement IHttpHandlerFactory or IHttpHandler.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ConfigurationErrorsException: System.Web.Routing.UrlRoutingModule does not implement IHttpHandlerFactory or IHttpHandler.]
System.Web.Configuration.HandlerFactoryCache.GetHandlerType(String type) +12328272
System.Web.Configuration.HandlerFactoryCache..ctor(String type) +27
System.Web.HttpApplication.GetFactory(String type) +94
System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +375
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34209
có bất cứ điều gì tôi có thể làm để có được điều này làm việc? Tôi có thể tìm thấy rất ít thông tin liên quan về vấn đề cụ thể này và thậm chí ít giải pháp hơn cho những người đã gặp lỗi này.
Lưu ý: Nếu tôi thêm dự án WebAPI 2 làm trang web mới trong IIS, nó hoạt động hoàn hảo; của nó chỉ khi lồng nhau của nó như một đứa trẻ (hoặc thư mục ảo hoặc ứng dụng có cùng một vấn đề) rằng điều này xảy ra.
Cảm ơn
Dường như url của bạn sai. –
Nhận xét đã chỉnh sửa: Có vẻ như url của bạn sai. Ví dụ. Url của bạn là http://www.parentsite.com và thư mục ảo của bạn là MyApi. Url cuối cùng của bạn là http://www.parentsite.com/MyApi/api/ –
Bạn đã bao giờ giải quyết vấn đề này chưa? Stuck trên cùng một vấn đề bây giờ: ( –