I'm using MVC2, mono 2.10.5, mod-mono-server4.
ELMAH is configured as per here, but I am using the XML file logger.
When trying to access /elmah.axd locally I get the following message in error log (indicating that the logging capabilities for ELMAH are working):
The controller for path '/elmah.axd' was not found or does not implement IController.
The following is still present in Global.asax's RegisterRoutes method as well:
routes.IgnoreRoute ("{resource}.axd/{*pathInfo}");
It seems like adding the handlers for ELMAH is not working with apache - it is working on a windows 7 desktop with cassini, haven't tried with IIS.
I can post more details if needed.
This may not be the best answer, but I've followed the directions here to display ELMAH information in a more MVC-friendly way (this makes it easier to allow remote access as well). I'm running into another mono-specific error now, but I will post that as a new question.
Related
I try to deploy ASP MVC 5 app in virtual directory (without creating new iis application)
I use IIS 7.5
I already put
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true" />
in web.config file.
But when i go to app url with IE browser it shows me just directory listing like in screenshot below
Is there a way to deploy MVC 5 in virtual directory and make it work like usual MVC application?
You need to convert the virtual directory to application. Right click on it in the IIS management console and choose Convert To Application.... Also make sure that the associated application is configured to use Integrated Pipeline Mode.
I solved this problem earlier in my production environment by checking the directory pointer in IIS. Apparently when I unzipped the deployed site from one server to the next, the zip utility made an extra level, so IIS was pointing to /MyProject when the files were in /MyProject/MyProject. I had a little better clue though, you have Document Browsing enabled based on that screen shot, make sure not to do that in production. I set the site to log custom errors and got a 403.14 response, from there found a blog on my mistake. You need to setup the environment to find the specific module that's failing, I think something to do with trace routes, idk. I'm a software developer that always gets forced into doing devOps; was googling my own problem and thought I'd throw you a line. Without a specific error message, all I can tell you is IIS is not connecting to .NET; something is not configured correctly. Turn off directory browsing, google how to get good error logs back, and let us know the status code so we can help you: 403.14, 401, 500, 404? Also give us the module that's failing. If it's the last one on the handler list, guess what, IIS isn't connecting to the app, which I suspect is your case.
I have an MVC 4 web site with an ApiController which has a Post method.
Locally everything is running just fine, I can post successfully.
However after I deploy to Azure, I get a 404 message.
I have tried everything I found within the first 7 pages of google..
I've tried the famous solution of adding the runAllManagedModulesForAllRequests module also.
Please help...
It would be helpful to see some code, hard to speculate otherwise.
Azure however, manages its resources separately. Are you pointing to the absolute path in Azure? Referencing resources locally within azure doesnt work unless you've set up a virtual lan and are referencing another machine in that lan.
I've a MVC 3 web application using WIF (only thing that matters here is that it's a http module and integrated into the processing pipeline), I've added in normal error handling via global.asax.cs's application_error handler. This works well for most of the cases where the basic application is up and running.
however, there is a class of errors where if the web.config is not configured correctly. (i.e. after a fresh install), the http modules, i.e. WIF assemblies throw exceptions.
I'm trying to put a custom error page for that as well to ask the user to look at the configuration,
however, any page hosted on the same website, even for static html still goes to the standard asp.net error page. My guess is that its still invoking the modules for static pages. Any one have idea on how to disable the httpmodules for certain areas or what the standard practice is?
This is how i'm configuring the custom error page
<customErrors mode="RemoteOnly" defaultRedirect="~/error.htm">
it's a simple static html page. page loads fine when the website is configured properly, but does not show when there is a http module level problem.
You can specify default websites setting in machine.config file. And even protect them from overwrites.
The machine.config file is located in x:\\Microsoft.NET\Framework\\config\machine.config
So if after deployment web.config file will be broken (or some settings) - proper settings will be taken from machine.config.
I have an asp.net mvc 2 application which works fine when run from visual studio either in release or debug mode. When the application is deployed to either a remote or local IIS 7 server in release mode it doesn't work.
The error displayed is as follows:
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
Now this is a bit misleading however I have worked out why this error message is being displayed.
The application does not have a default.aspx as this is not needed when running mvc apps on IIS7+
I am using attribute routing which is explained in the link below which uses reflection to build the RouteTable. When interrogating the assembly the attributes are not accessible therefore the RouteTable does not get populated
Since there are no routes the web server attempts to list the directory contents and it does not have permission to do that.
Attribute Routing:
http://itcloud.codeplex.com/
ASP.NET MVC Routing Via Method Attributes
Now my question is what is preventing the application from being able to interrogate the assembly using reflection?
DaTribe
Lack of ReflectionPermission is a likely cause. Many hosting companies over-restrict permissions. Reflection is one that is often problematic. GoDaddy and RackSpace both restrict it.
What trust level is your application running? What hosting provider are you using? Do you have RDP access?
I'm building an ASP.net mvc app, and am having some problems getting ELMAH deployed using xml logging to a medium trust server, though it works fine on my local machine. It keeps getting a 404 error.
The problem might be that the host doesn't allow relative filepaths, so the "~/App_Data" doesn't work for logging. I switched that to:
logPath="\\Something\Something\ID\www.website.com\web\content\App_Data"
in the web.config. The syntax might be completely off, but I've tried a few variations and none of them worked.
I subsequently found this question and added the recommended code to my web.config, but still no luck. Does anyone know how to get ELMAH to work on medium trust?
Thanks!
The asp.net worker process (or the aspnet user) has minimum rights to write into the filesystem. Try a place like c:\temp where everybody can write files. After this check and set access rights for aspnet user.
It turned out that the ELMAH.dll was calling SQLite, which isn't allowed under medium trust, and was causing ELMAH to fail when deployed to medium trust. I needed to download the source code for ELMAH and re-build it without the reference to SQLite. It is now working. Yay!