Unable to find template in prod - symfony

I just uploaded my application to my webspace, and cleared the cache via ssh. But in the prod environment my log file shows me an exception:
InvalidArgumentException: Unable to find template "Project:News:overview.html.twig". (uncaught exception) at /path/to/my/project/vendor/symfony/symfony/src/Symfony/Bridge/Twig/TwigEngine.php line 123
Do you have any ideas what I can do?

In most cases the problem is, that windows is not case sensitive and linux is. So check your files and the case sensitivity of your files and folders.

Related

.NET Core - same project running under iis express on different drive

I recently bought a new computer. I moved the drives from my old computer to the new one, installed everything I needed to and opened my project. Now I'm trying to run my project in IIS express but it displaying an error specifying an html output as log file.
When I look at the html problem, it's a 500 error message generated by what looks likes an IIS page. It's saying that the config file cannot be found:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid
Config File
\\?\F:\Development\MyProject\API\web.config
When I switched to the new machine drive letters were changed, so the code I'm running is no longet on drive F like in the message above - it's now on a different drive. I've looked in my code - I have no reference anywhere to a specific path.
I've tried to do clean and rebuild but it doesn't work.
If I look inside files for the path I see that the DLLs are compiled with PDB file path inside them. Why is that? And what happens later on on production?
Also, how do I fix this problem? why does it keeps looking for old location?
I'm fairly sure the IIS Express metabase still has the old path configured for this site. Please see the following answer for how to locate the metabase file (it's usually here: \Documents\IISExpress\config\applicationhost.config):
Where is the IIS Express configuration / metabase file found?
I'm not sure what the most correct way is to correct the problem, but you should be able to manually edit this file and update the "physicalPath" attribute for your site to the correct path to resolve this problem.
I don't know the exact cause of my problem, but the solution was to delete all bin directories from all project folders and re-compile.
To delete the bin directory from all my project I wrote the following PowerShell script:
Get-ChildItem -Path . -Filter *bin* –Recurse | Remove-Item -Recurse -Confirm

Migrate from Openshift to WampServer, endup fail to run

In Openshift I have 1 application. I copied it to my localhost running wordpress website. I overwritten my localhost files. I copied all the files from data directory and as well as I copy mysql to overwrite my localhost mysql. Now I try to run the website. It gave me the following error message.
Warning: require_once(.openshift/openshift.inc): failed to open stream: No such file or directory in C:\wamp64\www\my-site\data\current\wp-config.php on line 114
any idea what I can do to fix this problem. What are the things I miss setup?
Thank You
If you run your wordpress site on localhost you don't need the openshift references. So comment out wp-config.php line 114 (because it requires the .openshift directory). Run it again and you will probably get some more errors (you don't need openshift hooks etc). Furthermore, it seems you didn't do the mysql part right. You should create a database (you dont have to overwrite one) and set the database credentials in your wp-config: https://codex.wordpress.org/Editing_wp-config.php#Set_Database_Name
Hope this helps

web.config error when trying to display an image

I ran into an interesting error when trying to load an image and I was wondering if anyone else has experienced this or even better know how to fix it.
So I have a virtual Directory setup through IIS 7.5 referencing a network share. I am using valid credentials and have verified that I can connect to the share using these credentials.
When I try to navigate to the image I get the following error:
Parser Error Message: An error occurred loading a configuration file: Invalid file name for file monitoring: '\\share2\EmployeePhoneListPhotos$\web.config'. Common reasons for failure include:
- The filename is not a valid Win32 file name.
- The filename is not an absolute path.
- The filename contains wildcard characters.
- The file specified is a directory.
- Access denied.
Now there is NO web.config file in this share folder, however it's just displaying a .jpg image from here so there should be no need for one.
Does anyone have any idea why it would even look for a web.config file in a folder that only had images?

iis7 / asp.net not showing modification of a file

I have currently moved my asp.net 4.0 web application onto IIS7 (windows 2008 server). I used a test folder to hold files from a directory on the localhost machine, however; when I moved the aspx file over and changed the code(on the server), the application keeps throwing this error
Could not find a part of the path 'C:\Users\***\Desktop\TestFolder\'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\****\Desktop\TestFolder\'.
I only have two functions that deal with directories and neither function points to that test directory anymore.
private int checkForFileNumbers()
{
string url = "c:/***/realfolder";
DirectoryInfo directory = new DirectoryInfo(url);
return directory.GetFiles().Length;
}
private void checkForFiles()
{
string url = "c:/***/realfolder";
DirectoryInfo dir = new DirectoryInfo(url);
foreach (FileInfo files in dir.GetFiles())
{
FileDropDownList.Items.Add(files.Name);
}
}
I have tried commenting everything in this aspx file out, only to find that this problem still occurs. I performed the issrestart from the cmd line and nothing changed. Any help would be appreciated.
This is a deployment problem. Your error message is clearly out of sync with your current code. The actual code that is being run from IIS must be coming from an out-of-date binary. As a starting point, I would delete all DLLs in your bin directory on the server and redeploy fresh DLLs. The may also require you to refresh your aspx files depending on what kind of project type you're using.
Once you get this sorted out, I would take another look at how you are deploying updates to your site. Visual Studio and IIS 7 offer some neat deployment options if you want to go that way. Also, you could deploy via Git or SVN. But deployment by manual replacing single files is going to lead you to the type of trouble you are currently experiencing.
If realFolder directory exists under root of your web-app or itself is root then use Server.MapPath method to get real path of virtual folder.
For instance,
String rootPath=Server.MapPath("~"); // It will return real path of current web-app's root.
//OR - In case if want use Server property from separate code file.
String rootPath=HttpContext.Current.Server.MapPath("~/testFolder");
Since you're not referencing the path in your code, it's probably either in one of your config files, HttpModules, Global.asax, or perhaps a DLL.
What other components are you using?
Before moving it to a server, have you tried running the site under IIS on your local machine? Maybe attach a debugger and see where the error is thrown?
Oh, FWIW, the IIS AppPool identity will need to have read permission for your C:/***/whatever folder.

HTTP Error 401.3 for specific .pdf file

I just uploaded two .pdf files on my server. They are both in the same folder.
The first one can be normally accessed but for the second one I get an
HTTP Error 401.3 "You are not authorized to view this page"
This looks weird to me. Do you have any idea why is this happening?
check filesystem permission if you are running linux. the user running the webserver should have read permission on both files you can do this with most ftp software or if you have shell access chmod a+r /path/to/your/file.pdf
if that does not solve the problem look for error in log file usually /var/log/apache/error.log

Resources