I have uploaded a site on azure using shared service plan.Whenever i try to download any excel file i get below error.
The process cannot access the file 'D:\home\site\wwwroot' because it is being used by another process.
I have used below download code to get fileLocation: HostingEnvironment.MapPath(#"~/Files/" + FileName)
It is working fine on my local environment. Issue only arises if i do the download from the hosted site.
Related
I have published a web application on App service. Web Application is working correctly on Local run. In a web application, I am taking thumbprint, Certificate file path, and certificate password as input from the user. Certificate details are input correctly into Azure App service published Web application but getting the error " The system can't found the specified path".
Here I am passing local machine contained certificate path from C Drive or D drive.
Please guide how to resolve error.
Please check below image
You can create your path or file OAuth2.0_AzureAD_A in the scm site, under the path D:\home\site. Like below.
We can operate on the path at this level and below. The others should be unchangeable. .
We have an app that updates a gitlab project and pushes/commits to master. When I run locally, the program runs fine. When I run on the application hosted server (not the gitlab server), I get a 404 "Project not found".
It's not the private access token, we just made a new one
I can sign in to gitlab on our app hosted server and find the project
I verified the account can push straight to master
There is no xdt transformation on the config files
I logged into the account on the app hosted server and hit the project via the same api url.
Here is the codified url:
RestRequest fileExists = new RestRequest(
$#"api/v4/projects/{project.id}/repository/files/{action.file_path.Replace("/", "%2F")}?ref=master&private_token={ConfigurationManager.AppSettings["JiraPrivateKey"]}",
Method.GET);
I'm almost thinking it's some sort of server setting, but I would think that I would get the 404 when I tried the api url in the browser.
After thinking about it, since I use the ConfigurationManager, I had to copy by .exe.config file to the server and not just the exe itself. After dragging the config and the exe over. It worked. :-(
I am currently having a problem when uploading a file using a file upload control in asp.net
I have published my page using IIS on a remote server and I am accessing that link on my local computer.
Currently when im trying to upload a file I get an error saying that path not found meaning its looking for the file path that is on my pc, on the server which of course doesn't exist.
How do I get this to get the path from my pc because im trying to copy/saveAs the file from my pc to the server.
My code:
String pathCombine = System.IO.Path.Combine(destinationDirectory, Path.GetFileName(file));
File.Copy(sourcePath, pathCombine);
I am facing issue in my web application which is made in asp.net. I have host the application on IIS server.and I am going to upload excel file to port data in database from application.when i uploading from locally from server itself its working fine but i when i try to uploading using public ip or outside then my application redirect to IIS root folder can any one tell me whats is the issue.
this could be an permission issue on your web.config, file and folder permission or maybe a missing reference to correct folder.
Web.config
What is the authentication ? Do you allow Anonymous access. I understand that you can upload fine if you open the side from localhost from the server itself. Did you try to open the side with public ip from the server itself ?
Application Pool in IIS
Look for the "Identify" configuration and set this to "ApplicationPoolIdentify"
File Permission
Look for the folder and ensure that the "IIS_IUSERS" got write permissions
Code Try to sepecify the correct path using the server.MapPath()
Dim myPath As String = Server.MapPath("foldername") & "\" & "filename.csv"
System.IO.CreateDirectory or System.IO.File.Create won't work from a web service when navigating to the app remotely. It works locally.
Environment:
- .Net 4.5, Asp.Net, C#
- VS 2012
Remote:
- Windows 08 R2
- IIS 7
- App Pool (.Net 4.0, Integrated)
Process:
The web service is in the project and is used in jQuery .ajax call with url: 'Services.asmx/UploadFile'. The WS method creates the folder chain (if not found) and writes the file.
The file upload works perfectly fine locally in VS.
It also works perfectly when published on a remote server and navigating to it locally on the server (thru RDC) either by localhost/{app} or by http://{ip}/{app}. The folder chain is created and file is written.
However, it does not work when navigating to it normally.
I'm pretty sure it's a user permission issue but I've exhausted all options. I've assigned modify rights on the app folder in wwwroot to "NETWORK SERVICE" and even though I'm sure unnecessarily to "IIS_IUSRS", "IUSR", "LOCAL SERVICE", "NETWORK" and none have helped! I just keep getting status 500 when I navigate to it normally. But it has always worked locally as mentioned above once I gave it "NETWORK SERVICE" modify rights.
Publishing a basic test app with a button and CreateDirectory in code-behind on the same server worked after assigning modify rights to "NETWORK SERVICE" on the app folder in wwwroot.
The create directory code in the web service is:
[WebMethod]
public void UploadFile()
{
string _userId = HttpContext.Current.Request.Form["userId"];
HttpPostedFile _file = HttpContext.Current.Request.Files["Filedata"];
string _uploadsFolder = Server.MapPath(String.Format(ConfigurationManager.AppSettings["FileUploadPath"], _userId, "Temp"));
if (!Directory.Exists(_uploadsFolder)) Directory.CreateDirectory(_uploadsFolder);
FileStream _fileStream = File.Create(Path.Combine(_uploadsFolder, _file.FileName));
_file.InputStream.CopyTo(_fileStream);
_fileStream.Close();
}
FileUploadPath in web.config is
When it works, it works with or without the "~/" in the path. And when it doesn't work, it's the same, with or without, it won't work.