httpHandler works for virtual directory but not similarly configured website - iis-6

I am setting up a 3rd party website which makes heavy use of httpHandlers. When configured as a virtual directory under Default Site on a 2003/IIS6 machine, everything works as expected. When configured as a standalone site on the same machine, pointing to the same directory and web.config however, httpHandlers do not work (404).
I have tried various changes to the path values of the handler's tags with no results. The pages themselves, and the application's code, all seem to execute find within the standalone site.
Any obvious things I might be missing?

Found my own answer, was a very simple thing.
An installer package had installed the virtual directory version of the site, and it had taken care of adding the file extension mappings. The standalone was manually configured and as such, I missed adding the mappings.
Resolved.

Related

aspboilerplate multi-tenant configuration using {0}.domain.com format

I downloaded the latest aspboilerplate. In documentation
it lists 3 tenant resolvers.
document ask to add;
Configuration.Modules.AbpWebCommon().MultiTenancy.DomainFormat = "{0}.mydomain.com";
to get domain based tenant resolving.
I am using hosts file to simulate actual URLs. So, I feel the app config should be something like below (apart from above code change to Abp module);
"App": {
"ServerRootAddress": "http://server.mydomain.com",
"ClientRootAddress": "http://{0}.mydomain.com",
"CorsOrigins": "...."
},
But the documentation doesn't mention anything related to that. So, I don't think the documentation is complete.
Then in IIS, I have two sites.
API site : server.mydomain.com. Bindings set to server.mydomain.com
Client site : mydomain.com. A new binding will be added such as subdomain.mydomain.com for new tenant(s). So basically in IIS for client site there can be many bindings with different subdomains portion, but pointing to the same site.
Then I ran the api site xxxx.web.host.exe. I assume it should pick the correct urls to listen to from appsettings. But it doesn't. it shows;
Now listening on: http://localhost:5000
And I am not sure where its coming from since there is no reference to that in code.
How can I get this properly configured to run on IIS with subdomain based tenant resolver?
Actual issue(s) were outside of what I have thought. In brief;
https://edi.wang/post/2018/12/27/path-caveat-with-aspnet-core-22-iis-hosting is one issue which crashed the app at the very beginning. Reason is it was loading log4net config file at Startup() and because of the way asp.net core 2.2 works, in IIS inproc mode it can't find the file.
https://weblog.west-wind.com/posts/2019/Mar/16/ASPNET-Core-Hosting-on-IIS-with-ASPNET-Core-22 this helped a lot to understand and tackle the issue.
Make sure you don't mix 32bit 64bit when hosting in IIS.

Virtual Directory to navigate to http://localhost/MyWebsite instead of http://localhost:8080

I have deployed an ASP.NET MVC 4 application to a new site I have created in IIS 7.5, which I have bound to port 8080. I can reach it by navigating to http://localhost:8080, but I want to reach it via http://localhost/MyWebsite.
I have added a Virtual Directory under my website, which points to "C:\inetput\wwwroot\MyWebsite\". However, when I navigate to http://localhost/MyWebsite, I am presented with a configuration error:
"It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level. This
error can be caused by a virtual directory not being configured as an
application in IIS."
Here is what my IIS hierarchy looks like (this is a demo since I have no internet access on the server I am working on).
I have two questions:
Why am I getting this error?
Is this the best way to go about achieving what I want? It seems messy to have the list of files and folders underneath the website and then again underneath the Virtual Directory. If there is better practice then please tell!
Virtual Directories cannot execute scripts, reason why you are getting that error. You need to make your MyWebsite folder an Application. Also, you don't necessarily have to create a separate website for your website, you can use the Default Web Site and create an application MyWebsite in there (it might be less confusing maybe?).

Imageresizer remote reader plugin not working on live site

I have followed the imageresizer's troubleshooting for when images do not appear as they are listed here:
Potential causes:
You are using the .jpg.ashx syntax, and you did not register the HttpModule properly in both places of your Web.config file.
You are using the .jpg.ashx syntax, but you're not using a query string. You should drop the '.ashx' unless you actually want to process the file.
You are using ASP.NET MVC, but do not have the MvcRoutingShim plugin installed.
You have Precompilation enabled, and are using an image provider. This is caused by a long-standing bug in the .NET framework.
However, everything works perfectly in my local development environment. I have the MvcRoutingShim plugin installed and all the correct web.config references. On the live site, all images referenced by either just a querystring OR the RemoteReaderPlugin.Current.CreateSignedUrl procedure are not found.
All images are resulting in a 404 error.
Any ideas?
The answer: DiskCache(ConfigurationError): Not working: Your NTFS Security permissions are preventing the application from writing to the disk cache
Please give user read and write access to directory "C:\inetpub\wwwroot{site}\imagecache" to correct the problem. You can access NTFS security settings by right-clicking the aformentioned folder and choosing Properties, then Security.

Glassfish: how to investigate roles/groups problems

I have a Glassfish server in production which uses JDBC Realm for authentication.
It works well, but there is the need to change all the roles/groups. I developed a new version of the web application in a test environment changing glassfish-web.xml and web.xml to align them with the groups contained in the groups table on the db for test. Everything works flawlessly. So I moved the web application to the production environment and updated the content of the groups table on production db.
The authentication works well but roles are not recognized. How can I investigate this problem ? I checked the production db and the groups table is fine and can be accessed for select. Glassfish-web.xml and web.xml are the same of the test enviroment. This is a real brain teaser. The only explanation I can give is that Glassfish-web.xml is discarded for unknown reasons or the old file is still present and read from some other location than web-inf directory.
Thanks for any help
Filippo
Explore your domain's folder under GlassFish root folder + \domains. If you are unsure what domain you are on, it is domain1 by default. Under this folder you should have a folder called applications. This folder contains the deployed version of all your applications, and it's the place where to check your application's Glassfish-web.xml configuration file.
Anyway, if you are having this kind of problems, a Clean & Build of your project, followed by a redeploy, usually works.

How can I get aspnet compiler to handle a page that contains an include file

I have a web application that lands on a shared hosting platform for my company. That platform has global header/footer code that all applications on the platform consume using include files. I can't change how the header files are structured and how they are to be cosumed--that is dictated to me by another group. I have a build server that does not has IIS installed by design. I am attempting to use the aspnet_compiler.exe during the build process to generate the precompiled website files for deployment.
However, when the build runs I get errors like this:
/Company/Controls/Header.ascx(7): error ASPPARSE: Failed to map the path '/sites/header.inc'.
The Header.ascx control has this server-side include in the HTML:
<!-- #include virtual="/sites/header.inc" -->
On my local machine, I have created a virtual directory in IIS named "sites" that points to the global header code (which I have also copied to my local machine). This same "sites" virtual exists in IIS on the hosting environment. I would really like to avoid having to install IIS on the build machine because it is a shared build machine and I don't anyone to mistakenly work IIS dependencies into their code. The build machine shouldn't need to have IIS.
What is the best way to get the precompiled site files that aspnet_compiler.exe produces during my build without installing IIS?
Microsoft has a very simple example of how to replace an include statement...
http://support.microsoft.com/kb/306575
Looking at the path of your error it seems you are already using some sort of global user control and I'm guessing this is a file which is reused by other applications or languages so I would suggest coming up with a more custom version with error handling and such since it is working over a mapped drive but the basic answer is you need to read the file and output it to the stream during the Render event.
Don't use server-side includes. They are ancient technology and are disabled on most modern sites.
I recommend you instead create .ascx files to replace each of the .inc files, and use those instead.
Try this:
<!-- #include virtual="~/sites/header.inc" -->
The ~ is a shortcut for "root of the web application."