IIS7 serving .Net web application (simple database site).
I have a weird issue where the backgroundimage(URL) property of a element will be served as "http:\localhost" instead of "http:\servername". This is a problem because when a user connects to my site, "localhost" would be their workstation, not the IIS server. So the image (in this case a button) is blank.
The issue is intermittent, recycling the application pool seems to fix the issue for a time and then it comes back. IIS server also runs a SQL instance which eats ~28/36GB RAM.
Anyone ever seen anything like this?
In order to fix this you need to search for all locations where "http:\localhost" is hardcoded in your web app and replace it with a dynamic path. Even though localhost can work in your code if it is relative to the server, there are times when it will not work, such as in a link. You should get in the habit of never hardcoding your urls.
If you are using MVC -
value = Url.Content("~/Images/MyImage.png");
If you are using Forms -
value = ResolveUrl("~/") + "Images/MyImage.png"
Or relative pathing -
value = "~/Images/MyImage.png"
Related
I have been given a zip file of an existing site to make some changes. All of the paths within the site use a path structure that starts with "/". In an environment where the site is mapped to a domain name, that is fine. However, when I drop the site into a folder on my development server which i reference like:
"//[myserver]/[thissite]/[index.cfm]"
I get constant 500 errors because every include or location reference looks at:
"//myserver/file"
This is probably a really simple issue to resolve but in my 20 years of developing sites, I have never had to deal with it as I always use links relative to the file instead of to the site root.
My first inclination was to just replace the links with relative links but with more than 800, it is not only impractical, but additionally, I can't change every page in the site. I am just supposed to fix the things that are broken.
My development server is running ColdFusion 11 integrated with IIS so the files are located in the "c:\inetpub\wwwroot\siteFolder"
I have tried:
Setting application mapping in an application.cfc file:
this.mappings[ "/" ] = expandPath("/siteFolder");
this.mappings[ "/" ] = expandPath("/siteFolder/");
this.mappings[ "/" ] = getDirectoryFromPath(getCurrentTemplatePath());
this.mappings[ "/" ] = getDirectoryFromPath(getCurrentTemplatePath()) & "/";
Tried setting up a new site in IIS:
Creating another website in IIS and binding it to siteFolder.myserver and myserver.siteFolder both of which resulted in DNS errors
I have also converted the folder to an application in IIS and still no difference.
I am thinking there might be a way to do it through url rewriting, but before spending more time on something that may not work, I thought I was ask for a little help to see if I was on the right track.
It sounds like your current process is to drop applications into subfolders of a single CF website on your IIS server. This will generally work as the presence of an Application.cfc in the subfolder will designate it as a new application with its own scopes, etc. As you've discovered however, it will mess with any absolute paths you may have in the templates.
Your best bet is to set this up as a new site in IIS. You need to set a binding up for it (I tend to use sitename.local) and you'll need to add that to your hosts file with the following format:
127.0.0.1 yoursite.local
Once this is done, you'll want to let IIS know that this is intended to be a ColdFusion application. ACF comes with the Web Server Configuration tool which should be in your start menu. (If not, you can find it in \runtime\bin\wsconfig.exe).
This will let you select which IIS sites are expected to use CFML and will set up the IIS connectors properly.
the linux-guy here has a question about IIS v6.
The case is, that i have a site running, when i do some specific tasks on this site ( Like deleting a specific item, three times in a row) the site will break, and a completely blank page will appear. Checking the response headers, i noticed that the server sends a "403 Forbidden: IP address of the client has been rejected."
Through a proxy, i can connect just fine.
Checking the site-options in the IIS manager, shows me that my IP is not blocked globally, its something thats just happening.
Where can i check for this? It happens automatically and the block ends after about 8-12 minutes, every time?
best regards.
Jonas
do you have access to IIS?
i assume blocking occure on web site side (inside ASP code), not in IIS.
please check IIS console, and make sure that there are no blocked IP's. If it's true, you should find database/table or some config file, where stored all blocked IP's. After that, you should get able to find ASP code, which is responsable for blocking....
you also could try make quick search inside all ASP pages for text like: "REMOTE_ADDR" and ".ServerVariables"
We have been using ABCpdf for years now. In fact we are on version 6.1 still. It has just always worked. But we have recently upgraded to Windows 2008 x64 / IIS 7.5.
Our code that converts HTML pages (Invoices) to PDF now does not work. The basics are that there is a QueryString based URL that renders the Invoice in HTML, this allows us to "preview" it, then to send it to the client we use ASP .NET to execute the ABCpdf code (calling that same URL from the server to the server). This time the output is PDF, and that's what is attached to an email and sent off to the client.
Pretty simple and straight forward stuff right?
This is what we noticed about ABCpdf:
1) PdfObj.AddImageUrl("http://localhost/..."); // Localhost does not work.
2) PdfObj.AddImageUrl("http://127.0.0.1/..."); // Local IP does not work.
3) PdfObj.AddImageUrl("http://41.XX.XX.XX/..."); // Live IP does not work.
Now this:
4) PdfObj.AddImageUrl("http://www.google.com/"); // Works perfectly!
So we know the code and everything about it technically can and does work.
But it seems that any time the AddImageUrl() function calls a location that points to itself, the page does not render and we get "Unable to render HTML. Page load timed out. Unable to load page."
I know it's not to do with the timeout because if I use Fiddler (on the server) to execute the exact same code, it works perfectly.
I suspect this is to do with permissions... what what permissions? I read this: "... this is because ABCpdf uses the Microsoft MSHTML component" but how do I set the permissions on this component. I have already turned off "IE ESC".
What am I missing?
So it turned out after fiddling with just about every setting, that it came down to the fact that IIS did not allow URL calls from w3wp.exe to the same "site" within the same IIS.
There is more on that here: http://support.microsoft.com/kb/316451
It wasn't the "MSXML2.ServerXMLHTTP.3.0" requests, these seems to work - and why it was so confusing. But in ABC PDF, there is obviously something similar, and so IIS was blocking it... in fact the entire "site" locked up while it was failing.
In the end all it took was to make a clone of the main site ("site2"), and changing the URL that was parsed to ABC pdf to use the clone site.
I have a website set up on IIS 7.5. The host headers are working, the pages are returning fine. But when the browser requests an image, I get a 404 message. And I noticed that in the 404 details, the "Physical Path" that is specified is on the "c:\inetpub\wwwroot\images...".
The reason this is so strange is that the website is on the "D:" drive: "d:\inetpub\wwwroot\images...". The physical path is configured properly on IIS (I've done this a million times) but when attempting to serve images, it's using the wrong drive... why? Where is it getting this? I'm competently experienced with IIS for more than a decade and I have never seen this before. WTF??
You probably have two web sites binding to the same IP address, and one of them (with the physical path shown) is being honored.
If you add your application/virtual under the one website that's not being honor, you will see this error.
You need to set up the application under the web site that's being honored by IIS when using the IP.
Having a strange issue - we have a page that uses a query string to get some information, this query string happens to contain the word set. When this happens, the page returns a 406 error (Client browser does not accept the MIME type of the requested page.)
The URL looks like example.com/folder/file.asp?variable=sunset boulevard. If I change the space to %20 it still returns 406.
On my local machine running IIS 5.x this doesn't happen, on our test server running IIS 7.x this doesn't happen, only on our production server running IIS 7.x over SSL. Note however that a self signed certificate on my local machine over SSL still doesn't produce the error.
So my question is, what does the set keyword in the URL tell IIS to do and is there an easy way to avoid it happening? I would like to avoid changing the space to a different character if possible.
Does your server have additional filters installed? Smells like the work of an agressive filter designed to prevent certain types of attack.