[Solved] Code not working when deployed on hosting server but works in local

on Dec 08, 2022 01:14 AM

I have a very big problem with my work and I need proper guidance please. I really do not know what is going on with a particular code. The code seems to work, but on the server it doesn’t. Is there anything in an online sever that can block a code from being executed?

I asked this because earlier on, the code was working online, on a host server, after a few hours it stopped working. Initially, the code was not working but then when I uploaded my Packages.config file to the host server, it began to work. Then just few hours ago, I tested it again and found that it is not working again.

My question goes thus:

Could it have been that I don’t have the files and folders where they are supposed to be?

Should I have used visual studio to host my website instead of uploading my files and folders directly to the Plesk control panel?

Maybe if I had used the “Publish” functionality in visual studio, it would have given me the built-in function that is required for everything to work.

Please I beg you guys, I really need help and guidance on this. I need to be worked through on the process one step at a time. Thanks, I am totally grateful

Download FREE API for Word, Excel and PDF in ASP.Net: Download
on Dec 08, 2022 01:18 AM

Make sure thatall required dlls available on the server.

Also refer below article.

ASP.Net iTextSharp System.Security.SecurityException: That assembly does not allow partially trusted callers

on Dec 08, 2022 01:55 AM
on Dec 08, 2022 01:59 AM
dharmendr says:
Also refer below article.

ASP.Net iTextSharp System.Security.SecurityException: That assembly does not allow partially trusted callers

 In the article it explains with the use of iTextSharp Project and it seems it's an older version.

I tried to build website and got these errors about my dlls



I'm thinking, what if I start all over and create a new website using the same aspx and aspx.cs files, images folders, bootstrap and all other folders that do not require assembly to work. Then I can use Nuget to get the packages required to work with assembly?

I guess that would help? 

I ask this because I remember acquiring a new laptop, so I had to transfer my website files locally to another machine and could have affected that some assembly got missed.

on Dec 08, 2022 03:14 AM

Please dharmendr,

I have two disturbing issues that I need to understand.

If I decide to build from scratch or create a new website, and then I copy my aspx and aspx.cs files as well as some folders like images, will it affect the website?

Also, does updating packages like iTextSharp, MessagingToolKit, Newtonsoft.JSON, Zxing, itext.kernel etc... afffect code written at an earlier time?

I just want to know if I create a new website and install thsose packages, then copy my folder's contents and aspx, aspx.cs files to the new site, it will cause iregularities because the code I have were written about 2-3 years ago?

on Dec 08, 2022 05:49 AM

If the version already installed are different than you are installing the version, then you might get issue with the code.

Because on latest version there might be different changes in the methods or romoved some.

So before installing you need to compare the version you are going to install with the version installed in your old project.