简体   繁体   中英

Running local website site from Google File Stream. 404 for image and css files. IIS Express

I used to keep my websites in a Google Drive folder which synced my files perfectly between my laptop and my desktop.

Since Google Drive changed to Google File Stream, which now has it's own G: drive. I am only able to run these websites locally on my desktop.

When I try to run the websites locally on my laptop, all relative files (/img /photo.jpg /Content/styles.css) are returned as 404. Text and images with absolute file names are displayed fine.

I am using Webmatrix which uses IIS Express on both my desktop and my laptop.

If I put the websites in a different directory on my laptop and update the path in applicationhost.config they work perfectly. So there seems to be an issue with IIS Express and Google File Stream. But only on the laptop.

It means I have lost the ability to easily sync my files.

Any idea would be really appreciated, thank you.

For anyone having the same issue, I have fixed this by doing the following:

adding this to web.config:

<handlers>
<add name="AspNetStaticFileHandler" path="*" verb="*" type="System.Web.StaticFileHandler" />
</handlers>

I then discovered there were case sensitivity issues, I had to change the following file names:

Web.config to web.config

_AppStart.cshtml to _appstart.cshtml

And I had to correct some case sensitive file reference errors in my code.

What I don't understand is why this website worked before making these changes when rooted in a different folder on my laptop. And why it worked when rooted in the same folder on my desktop computer. If anyone could shed any light it would be appreciated!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM