Elmah and 404s under IIS6 - iis-6

Just wondering if it's possible to get Elmah to log 404s that aren't picked up by the ASP.NET framework - i.e. the 404s that IIS spots and replies to.
Presumably this would involve some kind of entry in IIS -> web site properties -> Custom Errors tab.
Can't find any reference on how to do this.

Non-ASP.NET mapped extensions (e.g. static content, classic ASP, etc) will never hit the ASP.NET request pipeline so ELMAH will never know about 404 Not Found's generated by IIS6. You'd need to create a wild card extension mapping to aspnet_isapi.dll for this to be possible (or just specific extensions).

Related

run WCF service vb on IIS express display error when open web config

HTTP Error 404.3 - Not Found
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
Most likely causes:
•It is possible that a handler mapping is missing. By default, the static file handler processes all content.
•The feature you are trying to use may not be installed.
•The appropriate MIME map is not enabled for the Web site or application. (Warning: Do not create a MIME map for content that users should not download, such as .ASPX pages or .config files.)
•If ASP.NET is not installed.
ISS run
This error is related to Handler mapping, you need the svc-integrated mapping for the site, in order to make sure this mapping appears you can can try to go to control panel -> turn windows features on or off -> .NET Framework 4.7 Advanced Services (or equiv .net ver) -> WCF Services -> HTTP Activation

Infer a parameter in a WEB app depending on the URL

I'm developing a database backed web-app. I will be providing the same basic services to several branches of the same company.
Right now I have an Apache server with virtual servers and a resource server for reporting.
branch1.mycompany.com
branch2.mycompany.com
resources.mycompany.com
So basically when I call resources from the site I pass the site as a parameter.
branch1.mycompany.com -> resources.mycompany.com?branch=1&parameter=1
branch2.mycompany.com -> resources.mycompany.com?branch=2&parameter=1
Even with two branches there is a problem trying to keep up with updating both sites and now, I'm going to be implementing this scheme for seven sites.
So my question is this: Is there a way I can make a IIS or TomEE web-app with the following features?
I want to still allow each branch to access trough its URL
Even when there are 7 URLs; all of them will be pointing to the same web-app
Depending on the URL, is there a way the site parameter can be inferred or calculated so I can call the right resource or web service?
The user should never realize they are accessing a common web-app. (i.e. should not be redirected to web-app.mycompany.com?site=1.)
Tomcat (so tomee) has now a rewrite valve which is close to httpd mod_rewrite, this can surely solve that smoothly. I assume IIS has it as well but don't know it that much. Trick is to reverse proxy the requests.

WSO2 Identity Server - Cannot Configure Custom Catch-all Exception Page

WSO2 Identity Server 5.0.0
For things such as a 500 errors and anything unforeseen, I'd like to configure my Identity Server instance to have our own branded error page to hide the server technology for security reasons and also just allow the error a little confusion.
At any rate, this no help: https://docs.wso2.com/display/IS500/Customizing+Error+Messages
I tried editing /repository/conf/tomcat/carbon/WEB-INF/web.xml and added the standard way to define an error page for exceptions:
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/NiceError.jsp</location>
</error-page>
and then placed NiceError.jsp in /repository/conf/tomcat/carbon/
So when I make a 500 error reoccurr, things change, but I'm sent to the carbon management console login page. If I decide to login, I get served up with an 405 error like so:
HTTP Status 405 - HTTP method GET is not supported by this URL
type Status report
message HTTP method GET is not supported by this URL
description The specified HTTP method is not allowed for the requested resource.
Apache Tomcat/7.0.55
The URL looks like: https://hostname:9443/NiceError.jsp?sessionDataKey=eabd6c25-7c79-40a9-af87-3cd80a68367e&loginStatus=true
That doesn't help.
How can this kind of thing be setup to work? It can't be hard with the right information. Right? :)
The referred documentation page is to customize error messages for identity related errors as its name sounds. It is not to create custom error pages.
By the way if you need to create custom error page, which is applicable to all web applications in your server instance, you may need to add your error page to web.xml in /repository/conf/tomcat/ directory. It defines default values for all web applications loaded into your instance of Tomcat. As each application get deployed, above file is processed, followed by the /WEB-INF/web.xml deployment descriptor from your own applications.
Thanks

Web API Routing - Returning 404

I have a Web API project in MVC 4 but cannot find the URL to my web service. Rather than MVC, I am actually just using the C (controller) as I'm not returning a view and my model is located in an external project.
I'm using the default route, which is api/{controller}/{id}. The name of my controller is RESTController (I know, probably wasn't the best name) and is located at ~/Controllers/RESTController.cs
Based on naming convention, it seems that my web service should be located at localhost:port/api/REST but I'm just getting a 404 resource cannot be found error (no XML representation of the object returned or anything). Is this the expected behavior without a view?
The funny thing is that I also have a SOAP API in an external project that is actually just returning the REST API result and it works as it should. Doing unit tests on my methods passes... I just can't access it from a browser. I've tried every url imaginable.
Basically...
Would there a way to debug this? (ie. Turning on ASP.NET directory listing)
Does not having a view effect what is shown in the browser?
Shouldn't the browser return an XML file representing the object?
Am I missing something obvious?
Nevermind, I'm a moron. I found the problem... At some point I accidentally drag and dropped (drug and dropped past tense?) my Global.asax file into my Views folder... therefore my routes were not getting registered.
Working as intended now.

MVC4 access and identity script/style files issue

I've posted this problem on the Identity and Access Add-in page and MVC forums, but no solution is yet forthcoming, so I thought I'd try you lot.
I have an issue where if I add Identity and Access to an MVC4 project, the requests to script and css files become unstable and often don't get served by iisexpress.
Steps to reproduce:
Create a new MVC4 project - Basic, with Razor engine
Add a controller called Home - just bare controller.
Create view Index for action Index on Home controller. Use built in layout defined in _viewStart , so includes bundled jquery and modernizr
Enable IISExpress for the application
Test this application - should work fine. refresh, reload etc, all works ok.
Next, configure Identity and Access on the application with Local development STS. Leave all as defaults.
Test application again. You should see it go through the localSTS authentication and then request the Home/Index action - at this point it tries to get the script files but these requests hang. The page is delivered, but can't render as the script files in the tag prevent it doing so until the script requests time out.
If you fire up another browser session in, say, chrome, then you can navigate to the script file and it will be downloaded on that session.
Zipped project with this state is here: https://www.dropbox.com/s/dy2bs5fh70kubp6/MvcApplication3.zip
I've used fiddler and wireshark to try and identify what is happening, but it just seems like the request to iisexpress hangs.
I've tried this on both my machines. One 64 bit, the other not.
Both VS2012 Professional V 11.0.50727.1 RTMREL, .NET framework 4.5.50709, logged in as me, an administrator on the machine, VS running as administrator
Any thoughts?
Edit: some more things I've tried:
- Using Azure STS has the same effect.
- Removing the tag that is in by default means that the script files are all accessible, seemingly all the time as required, but the Thread.CurrentPrincipal.Identity is then the generic Identity - i.e. the user is not authenticated. Adding [Authorize] attribute to my BaseController then forces the authentication with the STS as with the web.config directive, and then has the same issues with the script and css files. I was kinda hoping that this might work as removes any authentication from the root of the project to the controllers only, but alas, no joy.
And lo. It was AVG antivirus
For some reason the combination of AVG and Identity and Access addin causes this issue.
I have tried disabling various components of AVG but it seems that the only solution is to disable it entirely.
So given that, who can recommend an AV that won't interfere with development activities?