ASP.NET how to persist user uploaded files across each deploy - asp.net

I am new to asp.net. I have created an web application and hosted in appharbor.com. I created a folder below the project to store the user uploaded files(\photo\product). However this folder is not persist across each deploy. Is there any common approach to solve this problem? Any guide will be helpful.

I assume you are using WebDeploy to deploy the application to AppHarbor. You can instruct WebDeploy to not delete existing files on the server from MSBuild using the following MSBuild argument:
/p:SkipExtraFilesOnServer=true
OR during the MSDeploy deployment using the following argument:
-enableRule:DoNotDelete

Related

How dotnet.exe serves blazor web assembly files

Can someone explain or refer to a document on how a blazor web assembly app is served by dotnet.exe process?
So here is what I have done and what I know.
Scaffolded a new blazor web assembly project using the command dotnet new blazorwasm -o BlazorTest.
Ran the project using the command dotnet run and it runs as expected.
Remember I am not using the --hosted parameter to include ASP.NET Core server.
As far as my understanding goes, the output of blazor web assembly project are set of static files which run inside of a browser process. In order for these files to run inside of a browser we need a web server like kestrel/iis or a cdn to serve these files.
Now my question is, in the current setup where is that webserver or cdn present which is required to serve the files?
The dotnet CLI is reading your Properties\launchSettings.json file.
The default profile launches the app using IIS Express.
If you want use the other Kestrel launch profile that is included in the template, you can use:
dotnet run --launch-profile "BlazorTest"
Note: The "project" profile will be scaffolded as the name of the app you specified in dotnet new

Application Insights added ConnectedService.json file to my project, Do I have to deploy it to the production server?

Follow up to this question:
Application Insights added ConnectedService.json file to my project, what does this do?
When I create a deployment package, via "Publish..." option, the package also include the following folder and files:
Service References\Application Insights\ConnectedService.json
I do not want to deploy something that is not required at runtime. Do I have to include the folder and file in my production server deployment?
No. Those files are only used by visual studio for its information, to know what services have been added and give you links back to them inside VS. None of that needs to be deployed. those files can all be set to do not copy/etc.

Deploying ASP.NET 5 application with backing DB on client servers

I'm writing an ASP.NET 5 application targetting .Net Core using EF7. When I'm done, I'd like to publish the application to a platform-specific installer that, when run, will install a service, deploy a database based on user-input credentials for a SQL Server. The service will self-host the ASP.NET application.
Is this possible? How would I go about achieving this?
Thanks!
We use MSDeploy at work to deploy all of our components: web applications, windows services, scheduled task, SQL databases, etc.
You could use the following command to package up the service code:
msdeploy -verb:sync -source:dirPath=/path/to/service -dest:package=servicePackage.zip -verbose
And this command to deploy it to the target:
msdeploy -verb:sync -source:package=/path/to/service -dest:package=servicePackage.zip -verbose
Use a database project for the SQL database and create a DacPac to publish. You can use MSDeploy to publish the DacPac:
MSDeploy –verb: MSDeploy-verb –source:dbSqlPackage="db.dacpac"[,dbSqlPackage-source-parameters] –dest:dpSqlPackage="TargetConnectionString"[,dbSqlPackage-target-parameters]
Finally use Manifests to wrap it all up into a single MSDeploy package.
Regarding the user input values for the database, I would use WebDeploy Parameterization files to define the variables and apply them to the database deployment. These parameterization files can be used for non-web deployments via MSDeploy. Then write some PowerShell to wrap the MSDeploy command for deployment to prompt the user for their inputs and edit the SetParameters file.

Create directory in web deploy package?

I have an ASP.NET WebForms application which I would like to publish to a Web Deploy package and deploy using the deploy.cmd script generated as part of the Web Deploy package. This basically works fine but I have one problem.
My application generates image files which are stored in a temporary directory as part of the web site (basically a subdirectory of the IIS site's physical location called temp). However, whenever I deploy my site using the deploy.cmd script, this directoty is deleted. Instead, I would like the deploy script to make sure the directory is present and that the IIS user has access to it. Is this possible to do with Web Deploy out of the box?

Deploy asp.net web application

I have ASP.NET MVC web application. I need to deploy it which consists of:
1. Changing some of Web.config sections
2. Building under Release configuration
3. Copying to my deployment server (optional)
What are the ways to automate this process?
1. Changing some of Web.config sections
Use the web.config transformation you can implemnt it by modifing the Web.Debug.config and Web.Release.config in your web project
2. Building under Release configuration
3. Copying to my deployment server (optional)
This post should help. Read also this about the publish thing
We use continuous integration via Jenkins/Hudson to build and a task in it to deploy to staging or production that uses msdeploy in a batch script.
For building, our parameters for msbuild for release builds are:
/Target:Clean;Build /Property:Configuration=Release
It does take a while to figure out the msdeploy options but it is worth looking into (it's what Visual Studio is using behind the scenes to do the deploy if you use the GUI-based approach).
In terms of building under release configuration & copying to your deployment server you can use MS-Build alongside a tool like Team City / Team Build to automate the process.
Here is a great post to get yourself up and running: How to use MSBuild to deploy an ASP.NET MVC application

Resources