System.Web.Routing.UrlRoutingModule does not implement IHttpHandlerFactory or IHttpHandler Error

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
in our Website this error is come every 5 minutes.
And i don't know from where its call..
can any one help us please..
we need robots.txt without this error..

our application automatic call http://www.xyzName.com/content/images/thumbs/robots.txt
And show below exception


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) +11872574
   System.Web.Configuration.HandlerFactoryCache..ctor(String type) +25
   System.Web.HttpApplication.GetFactory(String type) +104
   System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +262
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +137



Here is our code, please please please help



  public ActionResult RobotsTextFile()
        {
            //Default Code blocked by Nilesh
            if (_storeContext.CurrentStore.Url.Contains("tk"))
            {
                const string newLine = "\r\n"; //Environment.NewLine
                var sb = new StringBuilder();
                sb.Append("User-agent: *");
                sb.Append(newLine);
                sb.Append("Disallow: /");
                Response.ContentType = "text/plain";
                Response.Write(sb.ToString());
            }
            else
            {
                var disallowPaths = new List<string>
                                    {
                                        "/bin/",
                                        "/content/files/",
                                        "/content/files/exportimport/",
                                        "/country/getstatesbycountryid",
                                        "/install",
                                        "/setproductreviewhelpfulness",
                                    };
                var localizableDisallowPaths = new List<string>
                                               {
                                                   "/addproducttocart/catalog/",
                                                   "/addproducttocart/details/",
                                                   "/backinstocksubscriptions/manage",
                                                   "/boards/forumsubscriptions",
                                                   "/boards/forumwatch",
                                                   "/boards/postedit",
                                                   "/boards/postdelete",
                                                   "/boards/postcreate",
                                                   "/boards/topicedit",
                                                   "/boards/topicdelete",
                                                   "/boards/topiccreate",
                                                   "/boards/topicmove",
                                                   "/boards/topicwatch",
                                                   "/cart",
                                                   "/checkout",
                                                   "/checkout/billingaddress",
                                                   "/checkout/completed",
                                                   "/checkout/confirm",
                                                   "/checkout/shippingaddress",
                                                   "/checkout/shippingmethod",
                                                   "/checkout/paymentinfo",
                                                   "/checkout/paymentmethod",
                                                   "/clearcomparelist",
                                                   "/compareproducts",
                                                   "/customer/avatar",
                                                   "/customer/activation",
                                                   "/customer/addresses",
                                                   "/customer/changepassword",
                                                   "/customer/checkusernameavailability",
                                                   "/customer/downloadableproducts",
                                                   "/customer/info",
                                                   "/deletepm",
                                                   "/emailwishlist",
                                                   "/inboxupdate",
                                                   "/newsletter/subscriptionactivation",
                                                   "/onepagecheckout",
                                                   "/order/history",
                                                   "/orderdetails",
                                                   "/passwordrecovery/confirm",
                                                   "/poll/vote",
                                                   "/privatemessages",
                                                   "/returnrequest",
                                                   "/returnrequest/history",
                                                   "/rewardpoints/history",
                                                   "/sendpm",
                                                   "/sentupdate",
                                                   "/shoppingcart/productdetails_attributechange",
                                                   "/subscribenewsletter",
                                                   "/topic/authenticate",
                                                   "/viewpm",
                                                   "/uploadfileproductattribute",
                                                   "/uploadfilecheckoutattribute",
                                                   "/wishlist",
                                               };


                const string newLine = "\r\n"; //Environment.NewLine
                var sb = new StringBuilder();
                sb.Append("User-agent: *");
                sb.Append(newLine);
                //sitemaps
                if (_localizationSettings.SeoFriendlyUrlsForLanguagesEnabled)
                {
                    //URLs are localizable. Append SEO code
                    foreach (var language in _languageService.GetAllLanguages(storeId: _storeContext.CurrentStore.Id))
                    {
                        sb.AppendFormat("Sitemap: {0}{1}/sitemap.xml", _storeContext.CurrentStore.Url, language.UniqueSeoCode);
                        sb.Append(newLine);
                    }
                }
                else
                {
                    //localizable paths (without SEO code)
                    sb.AppendFormat("Sitemap: {0}sitemap.xml", _storeContext.CurrentStore.Url);
                    sb.Append(newLine);
                }

                //usual paths
                foreach (var path in disallowPaths)
                {
                    sb.AppendFormat("Disallow: {0}", path);
                    sb.Append(newLine);
                }
                //localizable paths (without SEO code)
                foreach (var path in localizableDisallowPaths)
                {
                    sb.AppendFormat("Disallow: {0}", path);
                    sb.Append(newLine);
                }
                if (_localizationSettings.SeoFriendlyUrlsForLanguagesEnabled)
                {
                    //URLs are localizable. Append SEO code
                    foreach (var language in _languageService.GetAllLanguages(storeId: _storeContext.CurrentStore.Id))
                    {
                        foreach (var path in localizableDisallowPaths)
                        {
                            sb.AppendFormat("Disallow: {0}{1}", language.UniqueSeoCode, path);
                            sb.Append(newLine);
                        }
                    }
                }
                Response.ContentType = "text/plain";
                Response.Write(sb.ToString());
            }
            return null;
        }








And in route

ots.txt
            routes.MapRoute("robots.txt",
                            "robots.txt",
                            new { controller = "Common", action = "RobotsTextFile" },
                            new[] { "Nop.Web.Controllers" });
7 years ago
http://stackoverflow.com/questions/40127625/system-web-routing-urlroutingmodule-does-not-implement-ihttphandlerfactory-or-ih?noredirect=1#comment67534335_40127625

this will help if you need robots.txt without errore
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.