app_code files not found by the project - c#

my name is samy and im going insane!
i got this problem that my class's in app_code are no visible afther im uploading them to the server.
localy every thing work fine.
i read some other qustions on this when a lot of answer were like this:
"Right-click on the item in the solution explorer, and select Properties. In the properties window, there is a Build Action option."
*when i right click i cant see any proprty button so i used F4 but then i cant see any build option only "Custom Tool", "File Name" , "Full Path".
and
"you need to publish your website first."
*this didnt work either.
or
"your class are not compiled.
*i tried to build solution and that didnt work either.
please help me becuse im starting read/see tutorials on how to make a good rope knots (this will probly fails too so dont worry to much lol)
this is the error im getting (its look like this becuse im using iframe)
http://img14.imageshack.us/img14/11/theerrorb.png
this is error i get if i publish the site and upload it to the server all the app_code files are compiled in the bin folder as you said.
http://img193.imageshack.us/img193/4436/errorifipublish.png

Possible Solution 1
I have seen this before when working with ASP.NET Web Sites. If my memory serves me right, you should make sure that the paths to your references are wired up correctly.
i.e. if you added a custom DLL to your project
C:\My References\Some3rdParty.dll
and you moved the DLL to another folder/location. Or you could simply have a reference to a DLL that cannot be found.
If you resolve these reference problems you could find that your App_Code gets compiled all of a sudden.
Possible Solution 2
Right click and go to the properties of each of the .cs files in your App_Code directory in the Visual Studio Solution Explorer and make sure that the Build Action is set to Compile.
Possible Solution 3
If you have your .cs files in sub-folders within the App_Code directory you should add the following to your web.config file:
<configuration>
<system.web>
<compilation>
<codeSubDirectories>
<add directoryName="MySubAppCodeFolderName"/>
</codeSubDirectories>
</compilation>
</system.web>
</configuration>
Possible Solution 4
In Visual Studio, right-click on your Web Site in the Solution Explorer and click Publish Web Site. Make sure that the Target Location is a folder on your machine.
Log-in you your web-server and go to the BIN folder there. In the BIN folder on your web site delete all of the App_Web_.dll and App_Web_.dll.compiled files.
From your machine, copy your web site (including the App_Web_*.dll's in the BIN) to your web server where your web site is located. The only file you should probably not copy across is your Web.config file.

Related

HTTP error 500.19 - Cannot read configuration file

In one of my ASP.NET apps, all of a sudden I am unable to run it in Visual Studio 2013 due to the error displayed below. It appears that it is trying to open the web.config from a path that doesn't even exist. All of my project code, including web.config, are located under C:\Projects\SourceCode\AFEManager\Trunk\AFEManager.Web. I've found a number of posts here from users experiencing a similar error, but the solutions seem to vary and none I've found so far seem applicable to my situation. I looked in that TraceLogFiles directory and the most recent log file there is five days old so it obviously hasn't been logging anything since I've been having this issue. Any suggestions are appreciated.
In my case I deleted all folders in D:\My Documents\My Web Sites\ before
Then I caught the error
There is a file .vs\config\applicationhost.config in my solution folder
It contains reference to the deleted folder. So, I deleted applicationhost.config and then pressed 'Create Virtual Directory' button in my project property Web page. It was recreated the file and the folder
I've been able to resolve this issue even though I can't say I fully understand all of the details. I'll attempt to describe the situation the best I understand it and hopefully others with greater insight can add further clarification.
After having been doing all of my development on my workstation, it was suggested that I begin doing this work in a new VM environment that had been set up for me. So I installed VS 2013 there and copied my source code from various projects over there. However, rather than follow my previous local path convention of C:\Projects\SourceCode[ProjectName]... this time I decided to use the directories that are set up during the VS install, c:\users[MyUser]\My Documents\Visual Studio 2013\Projects[ProjectName]. Sometime shortly thereafter, our infrastructure team made a change so that my home directory, c:\users\rmayer, was now being pointed to a common network drive, \totalsafety\TSUsers\rmayer. Everything continued to work without any issues.
However, due to various difficulties I had working in this VM environment, I decided to return to doing my development work on my workstation using the original local paths for my source code. This is when I began encountering the errors described above whenever I would try to run my code through VS. What I've begun to learn is that there is an applicationhost.config file that IIS Express uses located here: \totalsafety\TSUsers\rmayer\My Documents\IISExpress\config. It contains entries for each of my web projects; the one relevant to this issue had a section which looked like this:
<site name="AFEManager.Web-Site" id="8">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\rmayer\Documents\My Web Sites\AFEManager.Web-Site" />
</application>
<application path="/AFEManager" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Projects\SourceCode\AFEManager\Trunk\AFEManager.Web" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:19257:localhost" />
</bindings>
</site>
The physical path attribute listed under applicationPool="Clr4IntegratedAppPool" at that time was set based on the local path I had been using at the time I was working in the VM environment. Now that this one file is being shared regardless of whether I'm working locally or within the VM due to the move of the users' home directories, this path is invalid when I'm working from my workstation. By updating this path to C:\Projects\SourceCode\AFEManager\Trunk\AFEManager.Web, it now works correctly from my workstation.
Again, I have a limited understanding of how this is supposed to work, but what it's telling me is that I will be unable to do development work from multiple environments (not that I want to any longer) unless the local paths are consistent between all of them. If I'm correct about this, this seems like a less than ideal design.
I had this issue when I moved the project folder to the new machine. The problem is that the VS has the site registered in its config file (applicationhost.config) inside .vs/ folder but did not create folder inside %USERPROFILE%\My Documents\My Web Sites\. If you just click Create Virtual Directory inside the project properties (Web tab) it will not be enough.
First close your VS and remove .vs/ folder inside your solution directory
Reopen VS and click Create Virtual Directory inside the project properties (Web tab) - VS will register the site again and create corresponding folder inside %USERPROFILE%\My Documents\My Web Sites\
I changed the virtual directory path in vs\config\applicationhost.config inside the solution folder.
In my case, the project was located on network not my local disk. After copying the project to local, the issue was resolved. Hope it can save someones time who has the same issue.
You can change the path for the web.config to its real path in applicationhost.config file. This file is located in /.vs/config folder.
After changing the path in this file, save it and restart the project, it solved my issue.
This is happening because I have different work stations, but the project is saving in different folders.
Delete .VS folders that Visual studio created.
It might be hidden in your project structure.
Unhide the folders and look for .vs folder and delete that folder and rebuild the application.
Most simplest way to solve this issue.
Approximate reason to arise this error is copy project from another pc.
Solution:
Step 01: From Visual Studio Solution Explorer, Right click on your project and choose Open Folder in File Explorer.
Step 02: Open .vs folder (Hidden Folder) and
you will get 2 folder named config and another one is named as
your_project_name/config.
Step 03: Both config folder will contain a
file named applicationhost.
Step 04: Open both applicationhost file using notepad and find the directory showing in error screen (Config
File \?\C:\User\hp\Documents\My Web
Sites\YourProjectName\web.config)
Step 05: Just replace this
directory according to your pc directory. Example, in my pc I have
changed as below:
C:\Users\Sydur Rahman\Documents\My Web Sites\MyProjectName-Site
to
C:\Users\hp\Documents\My Web Sites\MyProjectName-Site
Note: Please make sure you have changed in both applicationhost file.
That's all. Now your project will run as expected!
Thank you PongGod!! I am not able to comment on your answer but I wanted to post anyway since I had the exact same issue while running an instance of Orchard. In my case, everything had been running great until I found a bunch of old project files located in:
%USERPROFILE%\My Documents\My Web Sites\
And started deleting them for no apparent reason. I then tried to start up Orchard from Visual Studio in debug mode and received the error message above. After applying the same fix to my applicationhost.config file, everything is working fine now.
In my case, I am assuming that the directories got mixed up because I had initially ran the default Orchard files from Visual Studio and from Web Matrix. Then later on, I downloaded the full source files and began running the files from a completely different directory. Thanks again.
Here is a solution i have found.
https://gyorgybalassy.wordpress.com/2015/03/06/i-asked-for-a-vs-folder-and-the-vs-team-gave-it-to-me/
(1)Find the applicationhost.config file in |YourSolution|\.vs\config
(2)Modify the VirtualDirectory PhysicalPath To your project.
(3)Restart solution. Start project.
(4)If it's still not working, try to check setting in your IISExpress config. If there is not site setting, copy And paste the setting to |UserOnYourComputer|\Documents\IISExpress\config\applicationhost.config
(5)Change the id to other id which not be used in IISExpress applicationhost.config.
(6)Start your project.
I experienced the same issue and I resolve it quite simply. My issue was arose after when I perform a merge operation in git repository, after merge operation Visual Studio some how changed my default project URL to the default URL of my partner's computer from where he pushed the last time in to my repository.
So here is how I resolved this error:
Simply go to the properties of the project.
From the left vertically aligned menu, select Web.
After you will Project url and a text box containing the default port number, now just aside that textbox there is a button "Create Virtual Directory".
Press that button and there you go.
It will again point the default url the current working folder of your project.
Hope it works for you all :)
After all this answers I find my solution. Delete te WebSite in the IIS and recriate. Why? Because I had create de website before installed the framework 4.5 and URL Rewrite.
Go to the project dir:
..\\{ProjectDir}\\.vs\\{ProjectName}\\config
Then delete the applicationhost.config file and recompile your solution.
That's all.
This steps helped me to get over this error
1.In Windows Explorer, locate the web.config file that is associated with the Web site.
2.Right-click the web.config file
3.Click Properties.
4.Click the Security tab, and then click Edit.
5.Click Add.
6.In the Enter the object names to select box, type computername\IIS_IUSRS, click Check Names, and then click OK.
Note* Computername is a placeholder for the computer name.
7.Click to select the Read check box, and then click OK.
8.In the Web.config Properties dialog box, click OK.

iis and asp.net mvc compilation

as project is in developing state uploaded Files on webserver has not been compiled for easy editing and other reason , when i edit model and add property to view , iis say that your model has no that because of old compilation files , solution that Tested :
Deleted Temp folder in windows\microsoft.net
<compilation batch="false" debug="true" targetFramework="4.5" />
add new line to webconfig to force new compile
yet it run old compiled files
Based on the comments, I will add an answer...
You need to actually publish the application: How to publish a web app. You can publish this locally on your desktop and copy the files onto the server, or you can publish direct to your server.
When you publish the application, the model(s) get compiled into an assembly in your bin folder, so you cant directly modify these files on the fly.
You can chose a setting to allow for views to be updated, but this is very limited.
So, best approach is to set up a publish profile for your DEV server, and make your change, and then re-publish. It will take you less than a minute to get the latest code on the server.

FontAwesome files not published to the web server

I'm using fontawesome in one of my web applications. The problem is that not all of the fontawesome files that is contained withing my Content folder is published to the web server.
Is there any way that I can get these files to be published without having to manually copy them?
Please check the following.
1) check if the font files are in your project in visual studio (i.e. event the files are in the the project folders in Explorer doesn't mean it is in visual studio project, see if you can view it in your solution explorer)
2) if you can see it in your solution explorer, right click on it and see if you see an option called Include In Project. if you see this, click on it and it will include the file into your project. Instead, if you see Exclude from Project then it's in your project.
3) right click on the font file again and see if the Build Action property is set to Content.
This actually had nothing to do with the files not deploying. I'm using bundling and minification and unfortunately it seems that MVC bundles are not smart enough when it comes to virtual directories.
A quick fix was to create a physical directory with the files giving me a 404 error.

Images don't show up after VS 2012 Publish

I have created asp.net web project. I have included some files in this project. Following all CSS standards required.
background-image: url('~/Images/sideheader.png')
I can see all pictures when I debug my site. But when I publish my site, I don't see any picture in my site.
Please help me resolve this problem.
When you manually add files (i.e. images/js/css) to a directory and use them directly in your html/css (as per your question) Visual Studio does not know they exist. You need to 'show all files' and then 'include in project' the images/files you want to publish.
Only the files which are visible (=included) in the Solution Explorer in Visual Studio will be published to your server.
You should use it like this :
background-image: url('/Images/sideheader.png')
in this way the relative paths resolves to the correct place .
Your URL isn't pointing to the file. It works fine on the debug server, because when you run it in debug, it starts up a testing server for your project that has a different configuration than the server you published to. Because you have it in a different directory, or have a different home directory configured, it can't find the image.
For anyone coming to this question, this was determined from testing if replacing the relative URL with an absolute one would solve the problem, which took place in the comment section of the OP.
You just need to add your folder images to your project and republish your project. To add the folder, go to solution explorer, click on show all files, right click on your images folder and select include in project. You don't need to change any urls of the images you have used in your css or any where else.
I ran into the same issue, in my case since the Images folder is not recognized by Visual Studio, I had to set read permissions to everyone. Once I set the Image folder permissions, my images showed up just fine.

"..allowDefinition='MachineToApplication' beyond application level" error on deploying the website on web host

I came across the solution of this genetic problem all across the internet and Stackoverflow, but none of them talk about the same after/on deployment. I also read this famous article . So, my website runs absolutely fine via VS 2010. However, I get this problem the moment I deploy my website using the copy tool of VS 2010.
There are three web.config files in. 1- root, 2- Users folder, 3- accounts folder. The tag exists in the web.config file in the root. The hierarchy of which looks like: domain.com / httpdocs / websitefolder / web.config. In the websitefolder there are Accounts and Users folders which further contain web.configs, but non of them have the tag.
What could possibly go wrong from the development machine to deployment? The error I am getting is on line:
Line 16: <authentication mode="Forms">
In the httpdocs, there are other projects with web.configs, can that be a problem? In that case, I also deleted their contents, but didn't help (but may be I should have done a better job? I don't know if this is what was required at all?).
Also, this is a website, so there's no bin or obj folder being created, none of that kind of issue. Please suggest, I am not able to figure out the problem. Thanks a lot.
Usually when you have multiple sites in sub directories of one site, inspite you delete a web.config, the problem will persist. In that case even the sub folders should be marked as an application.
Is the folder in which you have this website deployed an application in IIS? It is one main reason why this error could occur.
If its not, make it as an application and the problem should resolve.
Update: Seems you have used File System while developing your website.
Firstly install IIS server like "this".
Next you should create a virtual directory in IIS. See "this" . (in physical path, select the path upto your deployment folder)
Now run the website. If your problem is solved it means the issue is with the virtual directory in your remote server. So report them.

Categories