Reputation: 111
I have issue with my app after run it on VPS.
I installed IIS on VPS, removed DefaultWebsite, and add another one. Everything looks fine, website starts, but I don't have access to any files from folders like Content, Scripts, Templates and so on. That's mean i don't have any pictures, and styles on my website.
I try to grand permissions for IIS_IUSRS but files still don't display correctly. Website is on on same partition as system, and i think that's the problem, but i can't move it. I have just one partition :-( Any solution for it?
Upvotes: 10
Views: 26636
Reputation: 11
I found the solution here:
To use the UI:
- Open IIS Manager and navigate to the level you want to manage. For information about opening IIS Manager, see Open IIS Manager (IIS 7). For information about navigating to locations in the UI, see Navigation in IIS Manager (IIS 7).
- In Features View, double-click MIME Types.
- In the Actions pane, click Add.
- In the Add MIME Type dialog box, type a file name extension in the File name extension text box. For example, type .xyz.
- Type a MIME type in the MIME type text box. For example, type application/octet-stream.
- Click OK.
Upvotes: 1
Reputation: 1
I also had this problem, it turned out to be file path problem.
I tried to access the path as "C:\folder\file"
When i tried to access it as "\file" it worked, so it is going to be like "(your server)\file"
Not "(your server)C:\folder\file"
Upvotes: 0
Reputation: 13561
Probably not a common problem, but I accidentally created a virtual directory with the path to my default page, and that messed things up. I had to open the applicationhost.config file, and delete the virtual directory (well, probably could have deleted it another way, but I didn't figure it out until I opened the file, and since I already had it open, I went ahead and saved the changes).
Upvotes: 0
Reputation: 912
None of the above worked for me. What did work (and I remember from eons gone by) is the lack of a MIME type mapping confuses IIS. This is easy to diagnose as the problem if you can put files of different types in different folders.
Easy fix is the "MIME Types" section under IIS, either on the server, web site, or virtual folder. Just add "*.foo" and "application/octet-stream" as the MIME type which says "just send the bytes already!"
Upvotes: 8
Reputation: 3661
In my case, I had a file with the extension cache
- an unknown mime type within IIS.
My 404 file not found trouble was resolved by updating the site web.config to add mimeMap for file extension cache
, as follows:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="true" />
<security>
<requestFiltering>
<fileExtensions>
<remove fileExtension=".config" />
<add fileExtension=".config" allowed="true" />
<add fileExtension=".dll" allowed="true" />
<add fileExtension=".exe" allowed="true" />
</fileExtensions>
</requestFiltering>
</security>
<handlers accessPolicy="Read, Script" />
<staticContent>
<mimeMap fileExtension=".cache" mimeType="text/plain" />
</staticContent>
</system.webServer>
</configuration>
More about Adding Static Content MIME Mappings and Troublshooting a 404
Upvotes: 0
Reputation: 111
I also have add this code to make app running. Without it app don't work, but files show correctly :-(
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<remove name="BlockViewHandler"/>
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler"/>
</handlers>
</system.webServer>
Upvotes: 0
Reputation: 15407
You need to add a web.config
file to serve static files in each folder that contains static files with the following content:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
</staticContent>
<handlers accessPolicy="Script,Read">
<!-- For any request to a file exists on disk, return it via native http module. AccessPolicy="Script" above is to allow for a managed 404 page. -->
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />
</handlers>
</system.webServer>
</configuration>
Upvotes: 1
Reputation: 1564
Please check user in IIS. Site -> Basic Settings -> Connect as... (if I recall correctly)
By default user in IIS is IUSR. You have to change to IIS_IUSRS. And then Your permissions will work.
Upvotes: 0