Why are particular dll's deleted from Azure App Server site when deploying? - azure

I have a .net app that I deploy to Azure. It is compiled to the directory c:\publish\bin under Release compile option, but for some reason it deletes one dll in particular , the System.Runtime.dll.
So before it starts to deploy it displays this
Starting Web deployment task from source:
manifest(C:\LocalWebProject\obj\Release\Package\My.SourceManifest.xml) to Destination:
auto(). Deleting file (AzureAppService\bin\System.Runtime.dll).
Adding ACLs for path (MyWebProject)
Any ideas why this would happen ?

Particular dll's deleted from Azure App Server site when deploying:
I've created a sample webapp using visual studio and was able to deploy it successfully to Azure.
Program.cs:
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorPages();
var app = builder.Build();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapRazorPages();
app.Run();
appsettings.json:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
Build on IIS Server:
Published to Azure:
Output:
Need to check:-
Never put anything in bin. Bin is not a source folder for binaries rather, it is the destination location for binaries.
Dependency Tree
.CsProj
|
classlibrary.dll
|
.binlibrary.dll
It is preferable to think of the bin folder as it is created by a project as "output" directory; they should only contain files generated by the project build.
Instead of using build, try rebuild which will perform cleanup and build the current project. Usually, the outputs from previous builds are kept with the build command. Therefore, it may result these kinds of dependency related actions like "deletion of specific dll files". Rebuild does remove them and build again.
While cleaning up, it might remove the necessary dependencies also. It is possible to restore deleting files.
Note:
I suggest, Use Visual studio while working with Web Apps to avoid these kinds of issues.
Check for Visual Studio version and update it to latest versions.
Reference: dll files getting deleted

Related

Is it possible to use the swa-cli with existing Azure resources?

I have restricted access to a client Azure Resources. The client created a default static-webapp (let's call it "my-mvp") and a virtual machine for me to deploy a app and a api. I am not allowed to create any new static-webapps or any other service. When using the swa deploy -command it does not allow me to connect the existing source.
How can I link my-mvp project to the existing my-mvp static webapp in Azure?
Deployment on my own Azure subscription works just fine when using the swa deploy command and creating a new Static WebApp. Also my .yml configuration works fine so I got it all working. This question has merly to do with the usage of the swa-cli.
While trying out the swa-cli with swa deploy -command with the following configuration (swa-cli.config.json);
{
"$schema": "https://aka.ms/azure/static-web-apps-cli/schema",
"configurations": {
"my-mvp": {
"appName": "my-mvp",
"appLocation": "./apps/frontend",
"outputLocation": "build",
"appBuildCommand": "npm run build",
"run": "npm start",
"appDevserverUrl": "http://localhost:3000",
"apiLocation": "./apps/backend",
"apiBuildCommand": "npm run build",
"apiRunCommand": "npm run start:dev",
"apiDevserverUrl": "http://localhost:3002",
"apiPort": 3002,
"appPort": 3000,
"subscriptionId": "omitted for obvious reasons",
"resourceGroupName": "omitted for obvious reasons",
"tenantId": "omitted for obvious reasons"
}
}
}
I got the following output;
Checking project "my-mvp" settings...
✖ The project "my-mvp" is linked to "DevOps"!
✖ Unlink the project from the "DevOps" provider and try again.
my-mvp is the name of the static-webapp resource in Azure DevOps were I'm trying to attach this project to.
If I rename the appName to something else it gives me the default options;
Checking project "my-other-mvp" settings...
? Would you like to create a new Azure Static Web Apps project? › (Y/n)
Because I'm not allowed to create any new Static Web App I press "n";
Checking project "my-other-mvp" settings...
✔ Would you like to create a new Azure Static Web Apps project? … no
✖ The provided project name "my-other-mvp" was not found.
If I press "Yes" the response is a RestError. If I enter "Yes" with the appName "my-mvp" it gives me the very first reponse.
Is it possible to use the swa-cli with existing resources?

Blazor-server-side can't see GLTF files

i have my blazor app hosted on azure with iis
got some GLTF file i want to access with three.js but its like my app can't see any of my GLTF files.
i have added a virtual directory inside my blazor app in IIS manager. (E://Output) is added inside IIS as a virtual folder next to wwwroot
if i go to https://xxxxx.com/output/637650602249582109_Output/VisData/room.bin (this file exist fine, and it will start downloading it)
if i go to https://xxxxx.com/output/637650602249582109_Output/VisData/scene.gltf
it gives me a 404 ..
i have tried to add this in my startup:
app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions
{
ServeUnknownFileTypes = true,
DefaultContentType = "text/plain"
});
it kinda helped with files i included in the projects wwwroot folder (wwwroot/VisData/scene.gltf)
https://xxxxx.com/VisData/scene.gltf
But what am I doing wrong with the files i have includes thru a virtual drive?
Try to add the GLTF file extension .gltf to your IIS, .bin is already mapped:
This can be done by dependency injection, just add the following to your Program.cs.
using Microsoft.AspNetCore.StaticFiles;
...
builder.Services.Configure<StaticFileOptions>(options =>
{
options.ContentTypeProvider = new FileExtensionContentTypeProvider
{
Mappings =
{
[".gltf"] = "model/gltf+json",
[".glb"] = "model/gltf-binary",
[".bin"] = "application/octet-stream"
}
};
});
Full docs with an alternative option:
https://learn.microsoft.com/en-us/aspnet/core/blazor/fundamentals/static-files?view=aspnetcore-6.0#blazor-server-file-mappings-and-static-file-options

project deployment to zeit reads "warning project is missing a now.json file with version ###"

when deploying my project up to my zeit clipboard, after the success deployment a warning sign appears stating "your project is missing a now.json file with version ###". then i went to the zeit website to get the new version for now but it doesnt work. byt the way It's a node project. any help is appreciated
Updating to the latest version won't resolve this warning. Having the now.json files allows you to specify options. Zeit added support for additional options, these can be specified in the now.json file. It looks something like this
{
"version": 2.2,
"builds": [
{ "src": "*.js", "use": "#now/node" }
]
}
Note: You can still deploy to Zeit without a now.json file. However, if your project has no now.json file, or has one but no builds property defined, the projects source* files will be deployed directly as the output.
Learn more about now.json and what available options exist here
Learn more about sources and outputs here
*Sources are files that already exist in your project before deploying and can be used to define the output

Azure expressjs web apps

I have created an express application in Visual Studio. I am having problems running it in azure once I've hosted.
It does not seem to find my node_modules folder.
Whenever I deploy and visit the site, on Kudu under the /logStream url I receive the error
cannot find module 'debug'
I found out that the debug module was required in the www folder. I then removed it from there and redeployed.
After redeployment I get
cannot find module 'express'
When I run my app in production (locally), I do not experience these problems.
One suggestion was removing the node_modules folder and then publish to Azure, with that you then use npm install on Kudu powershell or cmd. I have tried this and the same errors still come back. Could you please direct me on how I can resolve this?
package.json:
{
"name":"app-name",
"version":"0.0.0",
"private":true,
"scripts":{
"start":"node ./bin/www"
},
"description":"descrt",
"author":{
"name":"myname",
"email":"myemail#smtpserver.com"
},
"dependencies":{
"body-parser":"~1.8.1",
"cookie-parser":"~1.3.3",
"debug":"~2.0.0",
"express":"~4.9.0",
"jade":"~1.6.0",
"morgan":"~1.3.0",
"request":"^2.72.0",
"serve-favicon":"~2.1.3",
"stylus":"0.42.3"
}
}

Module missing in Android Studio and Gradle sync fails

I have set up a brand new project in Android Studio 1.1 RC 1:
Created an Android project [app] (because there is no way to create an App Engine backend project right away).
Added an existing backend module by first creating a new App Engine module and then manually importing the files [backend].
Removed the Android app module [app].
Added a Java library module, same procedure, first creating a new module, then importing files [common].
Everything compiles fine, but Android Studio has two problems:
When I look at Project Structure, the [common] module is missing in the left pane, but it still appears as referenced module in the right pane!?
My Project tree looks fine and all modules are recognized, but gradle is telling me the sync failed.
Gradle says "Task '' not found in root project" ('' is empty string as it seems). I get a Warning and an exception in the log when running from Terminal, but it doesn't seem to be related (related to Indexing), so I haven't included it here.
settings.gradle has both modules specified:
include ':backend', ':common'
I tried to exchange the .iml file of the main project with a fake one which contains both modules, with the result that (besides multiple side effects) both modules were there. (I restored the original state because of the side-effects.)
Here are my gradle files:
Root module:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.1'
}
}
allprojects {
repositories {
jcenter()
}
}
[backend]
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.appengine:gradle-appengine-plugin:1.9.17'
}
}
repositories {
jcenter();
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.17'
compile 'com.google.appengine:appengine-endpoints:1.9.17'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.17'
compile 'javax.servlet:servlet-api:2.5'
compile 'com.googlecode.objectify:objectify:5.1.3'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'io.jsonwebtoken:jjwt:0.4'
compile project(':common')
}
appengine {
downloadSdk = true
appcfg {
oauth2 = true
}
endpoints {
getClientLibsOnBuild = true
getDiscoveryDocsOnBuild = true
}
}
[common]
apply plugin: 'java'
task sourcesJar(type: Jar, dependsOn:classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives sourcesJar
}
dependencies {
compile 'com.google.http-client:google-http-client-android:1.18.0-rc'
compile 'com.google.code.gson:gson:2.3.1'
}
apply plugin: 'maven'
group = 'cc.closeup'
version = 'v2-2.0-SNAPSHOT'
install {
repositories.mavenInstaller {
pom.artifactId = 'common'
pom.packaging = 'jar'
}
}
Any ideas? Anything else that you'd like to see here?
If you want to build an AE project only. You could try this tutorial for intellij idea jetbrains.com/idea/help/creating-google-app-engine-project.html
My mistake was I removed [app]. It seems that if you create an App Engine backend module, you must keep a "fake" frontend module in the same project to keep Android Studio/gradle happy.
In earlier Android Studio versions it was possible to remove the frontend module without problems, but it seems Google has locked this somehow. It still works when I keep the fake frontend module.
--
Why I configured it this way? In my configuration, I have backend and frontend modules in different projects, and I have the backend project install libraries into local Maven, which I then pick up within my frontend project (with a team you would choose a local Maven server). This configuration has multiple advantages, for example that I can test backend/frontend on two screens simultaneously without switching back and forth all the time. Some companies may also want this configuration to keep their backend code separate and secure.

Resources