Image can't show after upload website to host

Topics: Core, Customizing Orchard
Jul 8, 2013 at 5:20 AM
Edited Jul 8, 2013 at 5:23 AM
If I build my project through Visual Studio Development Server (Port: 30320; Virtual Path: /OrchardLocal), my images on website will show normally.
This is code I use to show picture:
<img src="@Href("~/Modules/Crawler/Content/Images/Home/Add WHITE.png")" width="40px" height="40px" alt="New Xpath Row"/>
However, they can't show when I deploy project to host ASP.NET even though I can find them in a folder on host and image paths are still correct.

What should I do ?
Thanks so much !
Coordinator
Jul 8, 2013 at 5:47 AM
Check your browser's dev tools. They should give you some additional info.
Coordinator
Jul 8, 2013 at 5:46 PM
Check the web.config file in the folder, it's needed to allow static files. Take the one from /MEdia
Jul 8, 2013 at 6:39 PM
Folder which contains images has web.config (get from Media), but it doesn't work anymore. However, if images place in Media folder, it can show normally.
Should images place in Media folder ?
Coordinator
Jul 8, 2013 at 6:47 PM
Try to put the web.config in the ~/Modules/Crawler/Content folder
Jul 8, 2013 at 6:50 PM
Image
The error occur when I open image link.
Jul 8, 2013 at 7:08 PM
Folder Content has web.config already.
Content of my Web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <appSettings>
    <add key="webpages:Enabled" value="false" />
  </appSettings>
  <system.web>
    <httpHandlers>
      <!-- iis6 - for any request in this location, return via managed static file handler -->
      <add path="*" verb="*" type="System.Web.StaticFileHandler" />
    </httpHandlers>
  </system.web>
  <system.webServer>
    <staticContent>
      <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
    </staticContent>
    
    <handlers accessPolicy="Script,Read">
      <!--
      iis7 - for any request to a file exists on disk, return it via native http module.
      accessPolicy 'Script' 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>
Coordinator
Jul 8, 2013 at 7:10 PM
Is your website running in integrated mode ?
Have you tried with a file not containing a space ?
Jul 9, 2013 at 5:31 PM
Edited Jul 9, 2013 at 5:34 PM
I've tried all that solutions, but it doesn't wok anymore. The images in Media show normally, however in my Module it not.
Have other suggestions for me now ? Thanks everyone.
P/s:
This is error when I follow then link of image which doesn't show.
Image
Developer
Jul 9, 2013 at 5:45 PM
What is the public url of your website?
Jul 9, 2013 at 5:48 PM
Www.iyw.dieuviet.com
Developer
Jul 9, 2013 at 5:57 PM
There's no Orchard site at that URL.
Jul 10, 2013 at 2:23 AM
Oh, I'm sorry. It's just iyw.dieuviet.com
Developer
Jul 10, 2013 at 3:28 PM
The server returns a 500 Internal Server Error when accessing that image. If you have access to the event log you should be able to find out the error. Also, you pasted an image in an earlier post, but it is too small for me to see. Could you show a larger image?

Also, could you try running the site locally using IIS Express 8 just to see if you can reproduce it locally?
Jul 10, 2013 at 4:04 PM
I've tried running the site using IIS Express 8, but nothing works better. When I open link of image, browser show that
Image

My log file in App_data/Logs:
2013-07-10 00:00:42,505 [8] Orchard.Tasks.BackgroundService - Error while processing background task
System.NullReferenceException: Object reference not set to an instance of an object.
   at Crawler.Services.SchedulerService.ExecuteJob() in c:\Users\McDona\Documents\Visual Studio 2012\Projects\CrawlerOrchard\src\Orchard.Web\Modules\Crawler\Services\ISchedulerService.cs:line 28
   at Orchard.Tasks.BackgroundTask.Sweep() in c:\Users\McDona\Documents\Visual Studio 2012\Projects\CrawlerOrchard\src\Orchard\Tasks\IBackgroundTask.cs:line 16
   at Orchard.Tasks.BackgroundService.Sweep() in c:\Users\McDona\Documents\Visual Studio 2012\Projects\CrawlerOrchard\src\Orchard\Tasks\BackgroundService.cs:line 31
SchedulerService is my scheduler interface, but I don't think it caused the images didn't show.
Jul 10, 2013 at 4:15 PM
This is Web tag in Properties of Orchard.Web
Image
I don't know why images show if I chose "Use VS Development Server" but it doesn't with the rest of options.
Developer
Jul 10, 2013 at 4:23 PM
The last two images you pasted in aren't loading.
Jul 10, 2013 at 4:32 PM
sfmskywalker wrote:
The last two images you pasted in aren't loading.
They are loaded, aren't they ?
Developer
Jul 10, 2013 at 4:36 PM
Not for me, sorry.
Developer
Jul 10, 2013 at 4:37 PM
The last image uses this url: http://i.upanh.com/vppvqf. Doesn't work for me.
Jul 10, 2013 at 4:38 PM
sfmskywalker wrote:
Not for me, sorry.
You may find them here:
http://i6.upanh.com/2013/0710/14/56748948.untitled.png
http://i6.upanh.com/2013/0710/15/56749200.untitled.png
Thank you so much !
Developer
Jul 10, 2013 at 7:50 PM
With those links I get This web page is not available
Jul 10, 2013 at 8:29 PM
Jetski5822 wrote:
With those links I get This web page is not available
Oh, my website is available at iyw.dieuviet.com !
Jul 12, 2013 at 5:44 AM
The Server error show that images have configured incorrectly ! However, I've pasted web.config in Media folder to folders which containted images. But it doesn't work any more.

Any other solutions for me ? Thanks all !
Coordinator
Jul 12, 2013 at 5:49 AM
This thread has become quite confusing. Can you summarize the latest you've tried, what you expected and how it failed?
Jul 12, 2013 at 6:11 AM
BertrandLeRoy wrote:
This thread has become quite confusing. Can you summarize the latest you've tried, what you expected and how it failed?
Summary:

When I build my Orchard project through Visual Studio Development Server (Port: 30320; Virtual Path: /OrchardLocal), my images on website will show normally.
This is code I use to show picture:
<img src="@Href("~/Modules/Crawler/Content/Images/Portraits/Document.png")" width="40px" height="40px" alt="New Xpath Row"/>
However, when I upload it to my host (http://iyw.dieuviet.com/), images can't show. And when I open the link of image (http://iyw.dieuviet.com/Modules/Crawler/Content/Images/Portraits/Document.png), the server show error that it configured incorrectly.

If images stay on Media folder, it will show normally. I've pasted Web.config file from Media folder to folder Content of Crawler module, but it doesn't work anymore, eventually.

What should I do ?
Coordinator
Jul 12, 2013 at 6:30 AM
The error your server is showing is not enough. Disable custom errors temporarily so you can see the full error message.