Reputation: 4641
I've created a asp webapi for my application to connect with DB. While developing on localhost everything is working fine. But after publishing nothing is working beside main page. It looks like my routing isn't working after publishing
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "sd/{controller}/{action}"
);
routes.MapHttpRoute(
name: "ParamApi",
routeTemplate: "sd/{controller}/{action}/{param}",
defaults: new { param = RouteParameter.Optional }
);
routes.MapHttpRoute(
name: "GuestApi",
routeTemplate: "sd/{controller}/{action}/{username}/{password}/",
defaults: new
{
username = UrlParameter.Optional,
password = UrlParameter.Optional
}
);
routes.MapHttpRoute(
name: "BriefcasePutApi",
routeTemplate: "sd/{controller}/{action}/{id}/{value}/{owner}",
defaults: new {
id = RouteParameter.Optional,
value = RouteParameter.Optional,
owner = RouteParameter.Optional
}
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
Only thing that is working after publishing is route with name Default
. None from the rest isn't. I get error like this:
Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.\r\n
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".`
I get this error when I invoke url like: http://domain.com/sd/content/get
On my localhost it works perfectly fine but not on azure after publishing
I might be wrong about that it is problem of routing but I don't know where else I could look.
I've created project in .NET 4.5 but after then I've found that I can't yet use it on azure so I've converted it to 4.0
UPDATE Ok. After quick check with controller I get blank page. No error :/
The check is that my action returns int number "2". So I know that problem isn't caused by some code in action. But now I get no error, no nothing. Just blank page
Strange thing: Firefox returns blank page but Internet Explorer returns Error 500
ANSWER BELOW
Upvotes: 0
Views: 1620
Reputation: 4641
I Found the problem !
I've backrolled from .NET 4.5 to .NET 4.0 but Entity Framework didn't backrolled from 5.0 to 4.3.1 so I had to manualy uninstall v 5.0 and then from NuGet I had to install the 4.3.1. After that everything started to work !!
Upvotes: 1