Publishing Website Errors

ivonsurf123

New member
Joined
Sep 13, 2024
Messages
2
Programming Experience
Beginner
Hello,

I just have a question that I cannot find in Google, but I have this website that brings photos through a path that I have built in the code like this:

CODE:

// Base path configurable
string baseImagePath = ConfigurationManager.AppSettings["ImageBasePath"] ?? @"\\WCUPOBPROC1-A\Old_Check_Images";

When I run it in my local computer, it works perfectly and the path that shows in the web browser is this:

https://localhost:44339/Images.aspx

But now that I have published in the server to go Live as a website, It is not working and the path in the browser is:

https://fnweb.wescom.org/Old_Check_Images/Images.aspx

But It gave me a few errors:

Error 404:

Error occurred on recovery Image: Error 404:

no-image.png:1

GET https://fnweb.wescom.org/Old_Check_Images/no-image.png 404 (Not Found)

Any help to resolve this issue will be appreciate it. Thank you.
 
Moving to ASP.NET...

You need to understand the code that you have written. If you didn't write the code, you need to ask the person from whom you took the code from. Your code has a null value handler that lets it fall back to a different value if the setting is null.

Either you have the hosting site a bad web.config file, or the hosting site modified the web.config to something different from what your have them. I either case, IIS could not find the "ImageBasePath" in the <appSettings> section of the web.config file, and so your code is falling back to your null handler.
 
*sigh* It would be helpful if you provided here the details that you provided in your Reddit cross-post of this same question.

Of note from your Reddit post:
All the photos are in this path: \\WCUPOBPROC1-A\Old_Check_Images

What I do is create the path and when insert the specific variables start building the path and after building the correct path, then start the searching. It does work perfectly in my local, but when i publish it to this site;

If the code is running on the web server that presumably is hosted on another machine, does that machine have access to the machine "WCUPOBPROC1-A" ? Does the app pool identity hosting your app have permissions to the file share: "\\WCUPOBPROC1-A\Old_Check_Images"?

You also mentioned that you are doing some path processing. It would help if you add some logging so that you can figure out what the initial baseImagePath value is, and the new values as you do that processing to end up with your resultant path. That will give you the most information about what is going on. You will be able to look at the logs to see what reality is as compared to your expected values. That's how debugging works -- tracing code paths and variable values. Debugging is not "run it and see if it looks right".
 
Back
Top Bottom