IIS 7 Windows Server 2008 / CSS file not loading within aspx - css

I've found out several topics related to this issue yet I couldn't find an answer which worked for my problem, which is following:
I moved my Asp.Net 4.0 site to a new server (IIS 7, Windows Server 2008). The server side is working fine but the CSS style sheet is not loading.
When I use firebug, I see the following on the part where css should be loaded
404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
Despite this message,I can display the content of the css (in text) on the web (such as ../Styles/button.css ..etc)
I have tried some solutions such as staticFile handler mapping on IIS or adding ASP roles on server manager (through control panel).
Any help would be appreciated
Kind regards

The articles/topics that you have found is talking about the same thing as Uali's answer, which is correct, but it doesn't always solve everyone's problem. The problem is also not about your css per se.
Before proceeding, make sure that you have enabled Static Content as the other answer instructed.
Then do these steps in the IIS Manager window with your virtual directory selected.
Open Handler Mappings.
Click Add Managed Handler in the Actions Panel located in the right.
In the request path field, type: *.css
In the type textbox, enter: System.Web.StaticFileHandler
In the name textbox, type in any descriptive name you want such as css fix.
Click OK.
Update:
I also forgot to say that you can do the same thing for .jpg, .png, .gif or any other file types if necessary.

Please Make sure Your IIS 'Static Content' is enabled.
Do to This follow these steps:
Open Control Panel
Click Programs
Click Turn windows features on or off in Programs and Features.
Open Internet Information services -> World Wide Web Service ->Common HTTP Features
Make sure Static Content is checked, Mark checked if it
is not.
Hopefully it will help you.

The process of enabling Static Content on Windows 7 is different from that on Windows Server 2008.
To install the Static Content feature on Windows Server 2008 and Windows Server 2008 R2, follow these steps:
a. Open Server Manager, and then expand Roles.
b. Right-click Web Server (IIS), and then click Add Role Services.
c. Under Web Server, click to select the "Static Content" check box.
d. Click Next to complete the installation.
Here is the complete step by step guide for both situation for reference.
http://support.microsoft.com/kb/2196177

Related

IIS 8 - 500 server error logs

I have a desktop application that makes a call to an asp page on the web server. The web server is currently returning a 500 server error and I cannot figure out how to get more detail.
There doesnt seem to be anything in the Event Viewer: Windows Logs->application.
Is there a setting I can make or another place I can find logs? Seems like this would be a typical issues but I cannot find any information on this.
(Also, the stack trace does not come through to the client application)
You can enable "trace logging" on IIS Manager. It fill create bunch of XML files you can easily investigate using IE installed on the server. (other browsers may fail to process xslt style files)
From Technet:
Open IIS Manager and navigate to the level you want to manage. For information about opening IIS Manager, see IIS 7.0: Open IIS Manager. For information about navigating to locations in the UI, see IIS 7.0: Navigation in IIS Manager.
In the Connections pane, click Sites.
In Features View, select the site for which you want to enable trace logging.
In the Actions pane, under ``Configure, click Failed Request Tracing.
In the Edit Web Site Failed Request Tracing Settings dialog box, select Enable to enable logging for this site.
In the Directory text box, type the path where you want to store the log files or click the browse button (...) to find a location on the computer. The default is %SystemDrive%\inetpub\logs\FailedReqLogFiles.
In the Maximum number of trace files text box, type the maximum number of trace log files that you want to keep, and then click OK.
PS: don't bother IIS 7.0, almost same as IIS 8.x
This should be a comment but comments don't let me add an image.
This is a screenshot of Matt Browne's comment. Upvote his comment if you find this helpful.
If you don't see the "Failed Request Tracing Rules" button, then you need to enable "Tracing" tracing in Server roles.
Here it is:
There is also this configuration that needs to be set:
I had to restart my machine in order for the server configuration to be recognized in IIS.

deploy asp.net project on another computer

Just to begin I am a beginner in ASP, and havign some difficulty in deploying my first application.
I made a asp.net project in VS2008, and I ws trying to deploy it on another machine and following are the steps that I did:
right clicked on website and published set loaction to c:\inetpub\wwwroot and pasted my app to this folder.
Then I went to control Panel- admin tool- IIS and there it showed the website which I copied then went to its properties added documents, set ASP>NET version, it was blank by default. Then edited the configuration and under authentication changed its mode to none.
And then when I cick on the app in IIS and browse it showed the desired output, but I need to know how to open the same app in browser.
Thanks
If I've understood this correctly - it does depend on how the website has been set up in IIS. At it's most simple it would be
As the default website
http://[external IP of webserver]/default.aspx
As a virtual under the website
http://[external IP of webserver]/[virtualName]/default.aspx
Assuming there is a file called default.aspx (insert your own)
if default.aspx is specified as a default document for the site
http://[external IP of webserver]
http://[external IP of webserver]/[virtualName]
if you are using binding to a specific IP and or port (look in IIS, left handside at the binding link - see image below)
http://hostname: optionalpost
Apologies if I have misunderstood
EDIT
To check whether the site is active at all and to get a better idea of what the external URL is then on the left hand side of IIS will be browse to website. Click this to check whether the site comes up at all.
If it does then the URL should be obvious. It could be one with a host header i.e. looks like a normal URL i.e.
http://mytestsite.com
If it is in this format then you may not be able to browse externally if you can't resolve this hostheader to the IP of the box. To get around this then edit you host file and add a mapping from the url to the external IP of the box.
Host header is at following in windows 7 (or windows generally i think)
C:\Windows\System32\drivers\etc\hosts
Please back this file up before editing it

Remove NEGOTIATE from WindowsAuthentication in IIS

I have a site running in IIS 7.5 that is accessed using a DNS alias different from the actual server name. In IE 8, integrated authentication is failing, but in Firefox and Chrome everything works fine. (IE presents a credential challenge a few times, then displays a 401.1 error page.)
I have figured out that this is due to IE using Kerberos (aka "Negotiate") over NTLM, and Kerberos requires registering a Service Principal Name (using SETSPN) so that the mismatch between the DNS name and the server name is properly handled.
My web site, however, doesn't need impersonation--it is enough to have delegation. So instead of messing with SetSPN, I would just like to remove "Negotiate" from the list of WindowsAuthentication methods in IIS.
I have searched for quite some time to find out how to do this in IIS. I have played with many appcmd commands--but I just can't find online examples, or figure out how by reading MSDN documentation or using appcmd /? to make appcmd commands apply only to a particular application within a site rather than to the entire web server. A few search-hours later over two days, and at least 3 dozen web pages visited, I am still coming up fruitless.
How in tarnation do I get this done--it seems like it should be so easy!
Open the Configuration Editor in IIS. It comes with IIS 7.5, or you can download the IIS administration pack for IIS 7.0. Navigate to the scope you want to affect (server, site, or application) and then open the icon:
.
Change the Section to system.webServer/security/authentication/windowsAuthentication:
Click on the providers item, and then click Edit Items on the right. Select the "Negotiate" item and click "Remove":
Close the dialog and click Apply in the Actions pane on the right.
Your problem is solved! No more Kerberos/negotiate!
Note: you can also click Generate Script in the actions pane to display the code that will make the change in either C#, javascript, or with appcmd from the command line.
For reference, here is the appcmd statement to do the job without using the Configuration Editor.
appcmd.exe set config "Virtual/path/to/application" -section:system.webServer/security/authentication/windowsAuthentication /-"providers.[value='Negotiate']" /commit:apphost

HTTP Error 403 - Forbidden

When I start Debugging on asp.net3.5 . Browser display bellow message
*Server Error in '/attn-web' Application.
HTTP Error 403 - Forbidden.
Version Information: ASP.NET Development Server 9.0.0.0*
It might be an issue with NTLM Authentication.
Right-click on your solution in the Solution Explorer.
Select Property Pages.
Select Start Options in the dialog.
In the Server section, uncheck NTLM Authentication
If you have Vista or Windows 7 try running the Visual Studio as administrator (right click the EXE and choose "Run as administrator") as it might be some security/permissions issue.
I was getting following issues, after trying their solutions i got this same error message
WCFTestClient The HTTP request is unauthorized with client authentication scheme 'Anonymous' (my service is a non-WCF service)
The HTTP request is unauthorized with client authentication scheme 'Ntlm'
and finally got the solution from here which is In the Server section, uncheck NTLM Authentication (Project Properties -> Web -> Servers)
Firewall,
bad 'hosts' file,
aspnet server configuration problem,
Folder security restrictions
..
Try to look at log files (Win+F, select folder /Windows and specify to find fresh files) and 'Event Viewer' (Press Win, then type: Event Viewer)
P.S.: Nothing personal, but your question is really unclear.
you just need to change the specific port you are using:
Right-click on your project in the Solution Explorer. Go to
Properties. Select Web in the dialog. Change the Specific port to
anything else e.g. 44444
hope this is the solution for your problem
It happened to me too. I had moved the project and fetched it again. It turns out that Visual Studio binds the virtual directory name as the source path for the files, and moving a (physical) directory makes IIS adjust the virtual directory to the new path. Visual Studio uses the virtual directory name still, and that causes a conflict.
Deleting in IIS the virtual directory made things work again.
I also had the same problem. This is how I solved it. I think this may be helpful for you.
1. Go to "start" and then type IIS(Internet Information Services) and hit Enter
2. In the right side there are "connections"
3. Go to "sites"-> "Default Web Site" which is located inside the connections
4. Double click the "Default website"
5. There in the features view double click the "Directory Browsing"
6. In the right side there are the actions if "Enable" is available double click on that (Otherwise that feature is all ready available)
7. Then go back to the previous page
8. Double click on "Default Document"
9. There you can see a list of default documents
10. If your default document for the website is not available you can add it by clicking the "add" in the right side and there type the name of your default document.

Classic ASP Error 405

I have several development sites on my wix XP laptop (all classic asp). Doe anyone know why i need to type localhost/site/default.asp (i keep getting a 405 error on iis 5.1) and not just localhost/site
You need to add "Default.asp" as a default document. From this page ...
With iis 4.0 and iis 5.0 the change is
performed as follows:
Start the Internet Service Manager (Start - Programs - Administrative
Tools - Internet Services Manager).
Expand the computer and select the web site.
Right click on it and select Properties.
Select the documents tab.
Check the Enable default document box and click Add to add a new default
name. The order of the search can be
changed by clicking the up and down
arrows.
Click Apply and then OK.
Per comment ... okay, check your script map settings, per this article.
Sounds like you need to configure your default document type in IIS to be default.asp.
First off we need to clear up the web site thing. You only have one web site, the default web site. (It is possible to munge the metabase on XP to create multiple web sites but IIS 5.1 will only serve one of them, the others will have to be stopped).
You have multiple applications which are virtual directories under a common default website.
Have you checked that Default.asp is in the list of default documents for the application not the website? In IIS manager open properties dialog on each applications virtual directory and check the config there.
If you have then you've got a strange one on your hands. At this point I would always advise checking permissions. Does the application allow anonymous access, if so does the anonymous user have access to the folder and files?
This might seem strange advice since accessing the default.asp directly works but in my experience when the configuration looks good and should work but isn't 90% of the time its the result of permissions not correctly set up.
A 405 http response status code means "Method Not Allowed". The Wikipedia article List of HTTP Status Codes has this definition for the error:
A request was made of a resource using
a request method not supported by that
resource; for example, using GET on
a form which requires data to be
presented via POST, or using PUT on a
read-only resource.
You can try the third XP PRO IIS Admin, which can add more than one site to the IIS 5.1, you can switch the site with no difficulty.

Resources