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
Related
I have a ASP.NET MVC project locally, but want to push to a remote server so that others can use that website. I have login access to the remote server.
Is this what i need to do?
1) add a folder to IIS in the remote server
2) copy my files to the folder on remote server. If so, which files should i copy?
If you're using Visual Studio (not code) then right click on the project and select publish, then select the options to publish to a local folder. Copy all files in your published folder to your server.
If you're using ASP.NET Core then you can also navigate to the project folder and use the following command
dotnet publish -c Release -o PUBLISH_PATH_HERE
You will need to ensure that the server has your version of .NET runtime installed.
Create a release publish profile, publish, grab the files from the directory it published to. This is the simplest way. You can automate this process if you have many releases. For example publishing directly to the server or checking code into a source control of some kind and having it publish to the server.
I have an application in ASP.NET Framework 4.6.1 that works fine when running in my local environnent using Visual Studio 2017 (version 15.7.27703.2035).
On server side, the same application is displaying an HTTP ERROR 404.
Screenshot on local environment
Screenshot on server environment
To publish the ASP.NET application, I am using the publish tool of Visual Studio and deploy everything on an App Service of Azure.
Visual studio publish tool and project architecture
I tried to use FTP deployment instead of Web Deploy with no success. I also tried manualy with FileZilla with no success.
Is it possible that some sort of action is needed when publishing a project with custom libraries?
EDIT
What I know:
dlls on server side I actualy have access to the wwwroot folder on server side: this mean I can access js, css, images, etc. But it seems that controllers, views and others folders don't exist on the server..
Libraries issus? The problem appeared when I subdivided my project with the customs libraries CrmDatabaseManager, SysaidDatabaseManager and UserInterfaceLibrary.
wwwroot inside wwwroot on server side A wwwroot folder include anoter wwwroot folder on the server; the first wwwroot folder contains all dlls, and inside it, there is another wwwroot folder containing css, js, images and etc, but no sign of controllers or views.
How I created the project I created the project GPRH
this way using ASP.NET Core 2.0 based on .NET Framework
It turns out that split the project with libraries did broke path references.
I was hard coding the path and there were no problems with that into the main project. When I splited the project with libraries, it caused an error 404.
To access a file in a libary, you need to do this manipulation first:
Right clic on the file > Properties
On Build action, choose Always
copy the file
Then specifie the path this way on the library:
var buildDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var filePath = buildDir + #"\fileName.json";
using (StreamReader r = new StreamReader(filePath))
{
// code here
}
Background: I am doing a POC for CI using Jenkins and MSBuild. I have installed Jenkins, MSBuild plugin and other required components on my machine and configured as well. But I don't have IIS configured on my development machine.
I want build the ASP.NET website and output the published code in a folder "c:\precompiledweb" using MSBuild script. I have
Can someone help me with MSBUild Script.
Make sure you read the prerequisites for functionality.
https://msdn.microsoft.com/en-us/library/1y1404zt.aspx
Walkthrough: Deploying a Web Site Project by Using the Publish Web Site Tool
Prerequisites
In order to complete this walkthrough, you will need the following:
Visual Studio.
*This walkthrough assumes that you selected the Web Development collection of settings when you started Visual Studio the first time. For more information, see How to: Select Web Development Environment Settings.
Access to Microsoft Internet Information Services (IIS) so that you can test the result of publishing a Web site project. In this walkthrough, it is assumed that you have IIS running on your own computer. Alternatively, you can use any instance of IIS for which you have permission to create a virtual directory.*
You need access to some IIS server.
On the flip side....you need to keep this general rule in mind. Jenkins is simply a fancy wrapper for command line calls.
So test the below (article) on your machine without IIS. If you can get the command line to work (outside of jenkins), most likely you can get it working (inside jenkins)
http://www.asp.net/mvc/overview/deployment/visual-studio-web-deployment/command-line-deployment
Configure Source Code Management section, i.e. for TFS:
Add build step "Execute Windows batch command"
Insert msbuild invocation to your solution, i.e.
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe
"%WORKSPACE%\{solution_name}.sln"
You can add some optional parameters.
After build you can add another script invocation (batch, powershell, whatever) for copy project output to specific folder, but I would prefer another way: publish to IIS and run application immediately.
in Visual Studio create publish profile with WebDeploy target (help)
enable Web Deploy in IIS on test machine (help - when componentes are already installed go to "USING THE IIS MANAGER TO CONFIGURE WEB DEPLOY FOR A NON-ADMINISTRATOR" section)
add publish parameters to jenkins job from step 2, i.e.:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe
"%WORKSPACE%\ {solution_name}.sln"
/P:DeployOnBuild=true
/p:PublishProfile="{publish_profile_filename}.pubxml"
/p:Configuration=Release
/p:Platform="Any CPU"
/p:Password={Password_for_publish_profile_same_as_used_in_VS}
And now you have jenkins click-once job for build and publish solution to test server. Add Source Code change trigger and you have basic CI.
I have a website project (not a web application) and I want to set up deployment after builds with TFS. I have set this up and got it to work. I set up the build agent machine and the server and also created a publish settings file for the website project.
I know that the publishing agent is communicating with the IIS management service and that all permissions are set correctly, since after a build MSBuild does deploy the bin folder to the target. What I don't understand is why the rest of the website is not copied as well.
I run MSBuild with the following arguments:
/p:DeployOnBuild=True /p:AllowUntrustedCertificate=True /p:PublishProfile=QA /p:VisualStudioVersion=12.0 /p:UserName=[my AD user name] /p:Password=[my AD password]
I know these settings are correct, since the bin folder does get published, but how do I get the rest of the website project to publish as well?
What do you mean with the "rest of the website". Typically all your website assets are compiled into binaries and deployed like that.
If you wish to deploy additional files you can do this in the publish settings in your project properties:
I just change the Properties of my asp.net project like given below.
Property\Web\Use Local IIS Web Server \ Project Url: http://domain.com
Property\Web\Use Local IIS Web Server \ Override application root URL: http://domain.com
But after the commit in svn. The changes got reflected in other team members's project. Because these settings are in project file of application.
I also can't ignore this project file from commit. Because in this case other member won't be having proper update of my work from svn.
How can i keep these setting only personal to me, while keep committing the project file of the web application.
If you keep those changes in the project file you'll inevitably cause problems with versioning within SVN, which is not the best way to go. One approach is to leave the project settings as they are (I'm assuming that you're using IIS and everyone else is using Cassini or IIS Express) but create a website within your local IIS. Then, instead of running the application via F5 or CTRL-F5, manually attach the debugger to the ASP.NET worker process via Debug > Attach to process.