Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I got some issues after going from localhost to server. (mails won't sent and so on). I have another site online that doesn't have these problems, and i have now used lige 1 week to find out what the problem is.
The online difference in the folder structure in these two sites is that the one that works perfectly has all it's controllers in the app_code folder, and the one that doesn't work has all the controllers in a folder called "Controllers".
Can that be the problem?
When i try to make a app_code folder in the project that doesn't have it, it gives me some errors with my tryparse:
'out variable declaration' is not available in C# 6. Please use language version 7.0 or greater.
I'm running umbraco 7.13.1
You can see a screenshot of the folder structure here:
Hope someone has the solution for this problem
If i copy all the controllers in an app_code folder i get this error:
umbraco route names must be unique. parameter name: name
Umbraco load all controllers automatically from DLL and appcode, if you have the same controller in appcode and DLL this can cause duplicate name error
But is it required to have your controllers in a app_code folder, or is it okay to have them in a folder called "Controllers"?
Aren't your controllers compiled in bin folder?
Yes they are in the bin folder
I think -if I understand correctly- that you're confused about the states of the application.
Your folder named Controllers (or whatever you want to name it) is in the root of the project (usually) when you're working on localhost.
When you try to run the application, Visual Studio creates a bin folder and all the compiled .cs files (including Models and Controllers) go into the bin folder as DLL files. This is done in the background.
So, basically if I could guess, unless it's some weird setup, the Controllers on the other project have nothing to do with the fact it's running correctly. The bin folder in there (on the actual server) is the one that makes the application run. Someone correct me here if I'm wrong.
What i see in your screenshot is a project in an IDE, not a compiled application on the server.
You shouldn't be trying to make an app_code folder. You probably need to change the language version of your C# in Visual Studio (or whatever IDE you use) and then the problem will go away. Or change the problematic code to something C# 6 understands.
This is basically what a compiled Umbraco application looks like (with 7.13.2) running on the server:
P.S. I even think the sql folder is not used, I should delete it.
How to change your C# language version - Microsoft Docs
I think it's working now, but is it correct that when i publish the site to the server, using VS publish feature, the media folder images are not included?
And thank you so very much!
I think my issue was that the earlyer pages i made with umbraco, i just copied the files from local folder to server folder by FTP. But these projects has all had a app_code folder to the controllers. And as far as i understand the unique about that folder is that the files inside it compiles on runtime.
And when i just copying the controllers folder via. FTP the files are nok correct compiled, thats my theory.
Yeah, it doesn't work that way. Publish somewhere from Visual Studio with configuration set to 'Release'. Then you'll get the compiled app that you can copy to the server(or publish directly to the server, up to you). And yes, Media folder is not included, unless you include it in the csproj (I think).
I also think best practice is not to include the media folder overall. Just have an empty media folder on the server and Umbraco will populate any images you upload.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted