I created a web application in asp.net with sql server 2008 .I made a web setup project.Deployed into the server(IIS) with the msi i created.So for some reason a folder named "appdata" is getting created where the the application is deployed.
I even deleted the folder in my code and built again the msi.But still the folder is getting created.
Earlier i used the aspnet.mdf to create users but i am no longer using it as i am using a sql table.But still i am unable to know where my fault is .. Does it have some thing to do with my web.config file ?
Check to make sure that the App_Data folder isn't excluded from your project. If it is excluded, delete it from the project entirely and republish.
If that doesn't work:
Under the Publish dialog, make sure that the "Include files from the App_Data folder" checkbox is unchecked.
Related
I have problem with web site which is made in asp.net, in dev everything works fine, but since I published it to a server, I faced next issue :
After some time some items appeard in my folder called "Temporary ASP.NET Files" and I realized when there is few stuffs web site goes down and it shows this screen:
And what I saw in my TEMP folder was next:
AND TEMPORARY SOLUTION WAS TO DELETE FILES IN THAT FOLDER BUT AFTER WHILE THEY ARE AGAIN THERE AND SITE GOES DOWN.
I TRIED WITH PREVENTING USER TO WRITE THAT FOLDER BUT THAN I GOT ANOTHER ERROR WHEN I TRY TO ACCESS MY WEBSITE, SOMETHING LIKE :
...can not write to ... folder..
Thanks guys,
And kind of suggestion will be really great!
Thanks!
You have to add the XXXXX.dll files to the bin folder on your server.
Some times (I don't know why) some DLLs are not part of the project and you have to copy manually. If the file(s) already exists, you can replace the file with your local DLLs.
Check:
1. Project Framework VS Application pool.
2. Check all Dll's if include and its framework too.
3. Check eSavez_Servis Framework.
Just simulate your problem one by one.
I am new in mvc and c# and I can't solve following problem:
I am trying to create a folder named "Items" in solution folder.
I have tryed to use CreateDirectory method:
Directory.CreateDirectory("~/Images");
But it didn't work for me - folder wasn't created ..
Partly working solution was to create a folder by :
Directory.CreateDirectory(Server.MapPath("~/Images"));
"Items" folder was created, but it is not included in the solution:
How to create folder in solution directory so that it is included in project ?
(I needs to by done by code not by hand)
You need to understand what solution and csproj file is used for
In general, they're being designed and used for development with Visual Studio, and once the project is compiled, all these files will be ignored and excluded from the deployment package
Directory.CreateDirectory(Server.MapPath("~/Images"));
The code above simply create the directory if not existed yet in the deployment package at run-time, so you won't see it in your solution unless you run the project locally (either debug/release mode, it does not matter here). However, everything will run normally in hosted environment (ex: IIS).
For your information, here's the brief of what solution and csproj is
solution (.sln) file: contains information to manage one or many individual projects, contains build environments (for each project), start up mode (useful when you want to start multiple projects in one run), project dependencies and so on. Take a note that VS also read from suo file (solution user options) which is used to defined user-custom preferences (you should not include the .suo file in the version control, because it's custom settings)
csproj file: define the structures of project, what the namespace is, what is static folders, embedded resources, references, packages, etc.
Lastly, if you create the folder manually, VS will auto include that folder into deployment package AND csproj, but depends on the file type, you might need to change the Build Action and Copy To Output Directory in file properties.
Hope it helps.
A deployed web application on a web server doesn't have any notion of Visual Studio solution or projects. So the Directory.CreateDirectory(Server.MapPath("~/Images")) is the correct way to create a folder inside your web application at runtime but we cannot be talking about including it into a solution because this hardly makes sense in a pre-compiled web application. If you create the directory on your local development machine, you could always manually include the folder to the corresponding .csproj file, but at runtime this will not make any difference whatsoever.
The reason I wanted to create a folder (if didn't exist) was to make sure it exits before I try to store image in it.
After reading posts here and a few google searches I have concluded that the proper way to handle image upload would be
To create (In my case) folder "Images" by hand to be sure it exists
Then storing uploaded img in existing folder:
string path =Server.MapPath("~/Images/"+ UploadedImageName);
file.SaveAs(path);
I have some websites on my IIS machine. Lets say WebsiteA, WebsiteB and WebsiteC.
Inside .Net temp folder
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\{folderName}
each of the 3 website will have their own folder with some random name.
For example:
WebsiteA is using a folder named 5a3e1z1j. This folder will have the following path :
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\5a3e1z1j
WebsiteB is using a folder named b51o8881. This folder will have the following path :
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b51o8881
WebsiteC is using a folder named ad4966a9. This folder will have the following path:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\ad4966a9
How do I know which website is using which folder? So while the process of that website is still running, it won't allow me to delete the folder. It will only allow to delete the folder if I kill the process / stop the application pool or IIS.
Then I did some testing, what if I delete the folder (of course while there is no running process), what will happen to the site.
So apparently it will create a new folder with same exact random name.
Then I come up with a conclusion that this name is stored somewhere, so even though the folder is deleted. It will be recreated back with the same name.
My question is "How .Net create the name of these .Net temp folder so that for each website will have a consistent folder name? If it's stored somewhere after a successful build of the website, where can I find it?"
What I am trying to achieve is I want to create a tool that will do application pool restart if it's given input of website name. And also at the same time delete the .Net temp folder. But only the one associated to the input website.
If something is not clear, please let me know.
Thanks
I am using DevExpress v10.2 in my application. After deploying my application in IIS of my production machine, i am getting an issue as 'The type DevExpress.Web.ASPxEditors.ASPxLabel' exists in two locations. One of the location is C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files contains DevExpress v12.2 dll and the other location is C:\Windows\assembly contains DevExpress v10.2 dll which is not letting the application to run. I have stopped the IIS and cleared the folders in "Temporary ASP.NET Files" folder and again tried running it, but resulted in the same issue. I have given the screenshot of my issue.
Please advise on solving this issue.
Thanks in advance.
Perform these steps:
Stop your IIS server. (go to inetmgr, right click your computer name in the left tree and select stop.)
Delete everything you have in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files.
Start your IIS server again. (same as step one, but instead select start)
I'm having a "tiny" issue with my App_Code folders.
I'm learning ASP.NET and, therefore, ordered a webserver with the support of ASP.NET 4.0. I'm using Visual Web Developer to program my webpages. When I upload my website to this webserver everything runs fine.
However, if I then add another web project to my server, my App_Code folder gets all messy. The server wants all my class files in the App_Code folder in the root. Is there any way I can create subdirectories in my App_Code folder or something to keep my projects organized or am I missing the point here?
You should take a look at codeSubDirectories in the web.config
Alright I found a solution to my problem. Although most of your answers might work aswell, this proved to be the best in my case. I created a subdomain and threw all files into that folder and it worked fine.
You should try to avoid using the App_Code folder for your own stuff, especially if you're using a web application project.
Whenever you convert a website to a web application project, the process actually renames your existing App_Code directory to Old_App_Code.
See Here, even though this is specific to converting .net 2.0 apps, I believe it still holds true in 4.0 since converting a 4.0 app does the same thing.:
VERY, VERY IMPORTANT: Because ASP.NET 2.0 tries to dynamically compile any classes it finds under the /App_Code directory of an application at runtime, you explictly DO NOT want to store classes that you compile as part of your VS 2005 Web Application Project under an "app_code" folder. If you do this, then the class will get compiled twice -- once as part of the VS 2005 Web Application Project assembly, and then again at runtime by ASP.NET. The result will most likely be a "could not load type" runtime exception -- caused because you have duplicate type names in your application. Instead, you should store your class files in any other directory of your project other than one named "app_code". This will be handled automatically by the "Convert to Web Applicaiton" command. This command will rename the folder Old_App_Code.
If you have access to a hosting control panel it's probably best to configure your hosting environment with a virtual folder for your second website and run it from the sub folder, e.g. www.example.com/project-b. The first site can still be running in the root folder, e.g. www.example.com.
So both sites will essentially be isolated from each other (just like they are now isolated as two separate projects in Visual Web Developer Express). And both sites have their own App_Code folder (and web.config file).
If you don't have access to a configuration panel, most hosting providers are willing to add a virtual folder for you, since it's really not a special requirement.
The virtual folder should show up as a regular folder in your FTP folder, usually inside the www or wwwroot folder. Now you can copy your project files into that folder.
Take care to use root-relative paths for URLs in your second project, so all links will work even when the website is run from the subfolder. Root-relative URLs look like this:
<asp:HyperLink runat="server" NavigateUrl="~/Default.aspx" />
<asp:Image runat="server" NavigateUrl="~/images/logo.png" />
This will automatically go to www.example.com/project-b/Default.aspx and www.example.com/project-b/images/logo.png when the website is deployed in the virtual folder.
If you need to re-use code from one site in the other, it's typically best to move such code into a separate Class Library project type, and then add a reference to that project to each website project (right-click the website project, choose Add reference..., then select the Projects tab and select the Class Library project).