Good evening, I have been working on the project that has got a web app, api, a few libraries and some Azure functions. When I run only Azure function on its own it works just fine but today I noticed that when I select Multiple startup projects in VS2022 and run all project at once they are all running fine but my azure function is giving me error "No connection could be made because the target machine actively refused it.). In the console output I can see that the emulator starts whenever I start a Visual Studio however after selecting multiple projects I see the message "Stopping Azure Storage Azurite emulator..." I tried to restart Visual Studio but whenever I select it, it stops. Why is it stopping, is there any way how can I prevent stopping it? Thanks
As the default config uses ports of Blob, Queue and Table Services were 127.0.0.1:10000, 10001, 10002.
Make Sure no other processes listening on the Azure Storage Emulator Ports.
How to check if any ports are in use:
Open the AzureStorageEmulator.exe.config from the path C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator in a text editor.
From an administrator command prompt run these commands:
netstat -p tcp -ano | findstr :10000
netstat -p tcp -ano | findstr :10001
netstat -p tcp -ano | findstr :10002
You need to stop if any process is using the above ports or reconfigure the ports in the AzureStorageEmulator.exe.config file in order to be the port not being used by any other application.
Again, Run the Command Prompt as Admin > navigate to the above path (Storage Emulator Path) > Run the Command: AzureStorageEmulator.exe init
The storage emulator was successfully initialized and is ready to use - this message you will see if command runs successfully,
If the init command is not successful, check the error details and also the status of Azure Storage Emulator by running this command:
C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>AzureStorageEmulator.exe status
It should show IsRunning: True
If above steps didn't work, then check the Application Event log for any errors by going to the Event Viewer (available on Start button Search).
Try to Delete/Reinstall the Azurite or Azure Storage Emulator.
Please check these references for more information:
Run automated tests by using Azurite
Azurite Emulator
Azurite
If the accepted answer doesn't solve your problem, this worked for me:
Find the Visual Studio option
Projects and Solutions->Service Dependencies->Auto stop local services
and set it to False:
Asking very generally as I am completely new to Gitlabs CI/CD and CI/CD in general.
I have implemented a C# Net Framework application in Visual Studio 2017 and manage it with Gitlab.
Now I want to automatically create a binary of that application with the GitLab CI/CD feature.
I already have a runner ( docker based on Windows) registered in GitLab and run jobs.
My current YAML file looks as following:
default:
image: ruby:2.7.2
job:
stage: build
only:
- branches
script:
- set -m
- echo "Start build"
- '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe" /p:Configuration=Release /clp:ErrorsOnly; Build "NameOfApplication.sln"'
artifacts:
expire_in : 1 days
paths:
- '.\IndoorNavigation\bin\Release'
How can I now get the artifact / binary MSBuild generates? It should show up in pipelines for download right? I already tried the artifacts option with different path unsuccessfully.
Would also be happy for links to good tutorials as I have not found any tutorial that helped me.
Edit: Output of the Job:
Running with gitlab-runner 14.3.1 (8b63c432)
on docker-runner 2tZDZ6cX
Preparing the "docker" executor
Using Docker executor with image ruby:2.7.2 ...
Pulling docker image ruby:2.7.2 ...
Using docker image sha256:e6c92ed2f03be9788b80944e148783bef8e7d0fa8d9755b62e9f03429e85a327 for ruby:2.7.2 with digest ruby#sha256:1dd0106849233fcd913b7c4608078fa1a53a5e3ce1af2a55e4d726b0d8868e2f ...
Preparing environment
00:01
Running on runner-2tzdz6cx-project-1235-concurrent-0 via d98bb3402720...
Getting source from Git repository
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /builds/user/NameOfApplication/.git/
Checking out 2e50e922 as master...
Skipping Git submodules setup
Executing "step_script" stage of the job script
Using docker image sha256:e6c92ed2f03be9788b80944e148783bef8e7d0fa8d9755b62e9f03429e85a327 for ruby:2.7.2 with digest ruby#sha256:1dd0106849233fcd913b7c4608078fa1a53a5e3ce1af2a55e4d726b0d8868e2f ...
$ set -m
$ echo "Start build" - '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe" /p:Configuration=Release /clp:ErrorsOnly; Build "NameOfApplication.sln"'
Start build - "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe" /p:Configuration=Release /clp:ErrorsOnly; Build "NameOfApplication.sln"
Uploading artifacts for successful job
00:01
Uploading artifacts...
WARNING: .\NameOfApplication\bin\Release: no matching files
ERROR: No files to upload
Cleaning up project directory and file based variables
00:01
Job succeeded
My Dockerfile looks like this:
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8 AS build
WORKDIR /projectName
COPY . .
RUN nuget restore
COPY . .
WORKDIR /repoName/projectName
RUN msbuild ./projectName.csproj /p:Configuration=Debug
Locally, the msbuild step gives me no problems. Without a .dockerignore file, the build fails:
Process is terminated due to StackOverflowException.
When I add a .dockerignore file that looks like this...
./.git
./.idea
./.vs
./gen
./packages
./irrelevantProject1
./irrelevantProject2
# etc
...the build fails again, but with a different error message:
CompilerServer: server failed - server rejected the request 'Error reading response: Reached end of stream before end of read.' - b6c5574e-55ea-4d7d-adb3-e156ebd65296
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets(71,5): error MSB6006: "csc.exe" exited with code -2146232797. [C:\repoName\projectName\projectName.csproj]
Done Building Project "C:\repoName\projectName\projectName.csproj" (default targets) -- FAILED.
Build FAILED.
"C:\repoName\projectName\projectName.csproj" (default target) (1) ->
(CoreCompile target) ->
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets(71,5): error MSB6006: "csc.exe" exited with code -2146232797. [C:\repoName\projectName\projectName.csproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:31.66
The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; msbuild ./projectName.csproj /p:Configuration=Debug' returned a non-zero code: 1
I've been stuck on this problem for days. Any advice would be greatly appreciated.
Allocating more memory to the build solved this problem.
docker build -t projectName -m 4g .
A collegue of mine points me this compiler bug https://github.com/dotnet/roslyn/issues/59336
According to comments, compiler crashes on anonymous delegate function declaration and also when preview features are used (like "!!" syntax) but then removed from recent compiler version.
Fix is not yet available in recent Docker SDK .Net 4.8 image
My aim is to be able to use any packer for C# applications and libraries (preferring WPF) via command line or full build-in at Visual Studio.
I came accross .NetZ (http://madebits.com/netz/) that is pretty neat and worked pretty well until I tested it with a WPF application:
PackageExample.Program -> C:\Users\[username]\Documents\Visual Studio
2012\Projects\PackageExample\PackageExample.Program\bin\Debug\PackageExample.Program.exe
COMMAND: packcompress\netz-bin-40\netz.exe -o PackageExample.Program\bin\Debug\Packed -pl
anycpu -s -z PackageExample.Program\bin\Debug\PackageExample.Program.exe
"PackageExample.Program\bin\Debug\*.dll" -d:# -v
__________________________________________
| |
| .NETZ - .NET Executables Compressor |
| Copyright (C) 2004-2013 Vasian Cepa |
| [v0.4.8] http://madebits.com |
|__________________________________________|
PE subsystem : GUI
.NET Runtime : 4.0.30319.18052
Output directory: C:\Users\[username]\Documents\Visual Studio
2012\Projects\PackageExample\PackageExample.Program\bin\Debug\Packed
RID: zip.dll
Added : C:\Users\[username]\Documents\Visual Studio
2012\Projects\PackageExample\packcompress\netz-bin-40\zip.dll [65536 byte(s) ~ 64KB]
Processing : 3 file(s)
1| C:\Users\[username]\Documents\Visual Studio
2012\Projects\PackageExample\PackageExample.Program\bin\Debug\PackageExample.Program.exe
[255488 byte(s) ~ 249KB] -> [130850 byte(s) ~ 127KB] - 49%
RID: A6C24BF5-3690-4982-887E-11E1B159B249
2| C:\Users\[username]\Documents\Visual Studio
2012\Projects\PackageExample\PackageExample.Program\bin\Debug\PackageExample.Lib1.dll
[4096 byte(s) ~ 4KB] -> [1577 byte(s) ~ 1KB] - 62%
RID: PackageExample.Lib1!2!1Version=1.0.0.0!2!1!4=neutral!2!1PublicKeyToken=null
3| C:\Users\[username]\Documents\Visual Studio
2012\Projects\PackageExample\PackageExample.Program\bin\Debug\PackageExample.Lib2.dll
[4608 byte(s) ~ 4KB] -> [1617 byte(s) ~ 1KB] - 65%
RID: PackageExample.Lib2!2!1Version=1.0.0.0!2!1!4=neutral!2!1PublicKeyToken=null
Done [00:00:00.300]
The packed app throws this: http://i.imagebanana.com/img/251ygj82/Unbenannt.PNG
(The ressource mainwindow.xaml cannot be found.)
The problem seems to be the xaml .NetZ confuses, but I found some people who got it working on the internet, but I do not get any problem solution.
Are you able to help me in this case?
Additional information: It might be interesting to mention I even tried this with the .NET 2.0 .NetZ build on a .NET 3.5 WPF application.
I also had problems using NetZ to compress an WPF 4.0 exe and DLLs into a single exe.
My app.xml.cs would start to run, but then an UnhandledException of type NotImplementedException would be thrown:
Baml2006SchemaContext.ResolveBamlType ...
To troubleshoot this, I ran fuslogvw.exe to see assembly binding errors, and discovered that GalaSoft.MvvmLight.Wpf4.dll was failing to load from the Netz-packed assembly.
I then switched to NetZ.exe compiled from source and tried again.
After repeated experimentation, I see that if I recompile and NetZ-pack the app, it sometimes starts working. Recompile again the main app again, and NetZ produces a failing app.
In other words, something is intermittent.
Sorry for the not-so good news - either try another packing scheme, or try NetZ repeatedly on many builds, until you find a working one.
I have created a very simple window service using visual studio 2010 and .NُET 4.0.
This service has no functionality added from the default windows service project, other than an installer has been added.
If I run "installutil.exe appName.exe" on my dev box or other windows 2008 R2 machines in our domain the windows service installs without issue.
When I try to do this same thing on our customer site, it fails to install with the following error.
Microsoft (R) .NET Framework Installation utility Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Exception occurred while initializing the installation:
System.IO.FileLoadException: Could not load file or assembly 'file:///C:\TestService\WindowsService1.exe' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515).
This solution has only 1 project and no dependencies added.
I have tried it on multiple machines in our environment and two in our customers. The machines are all windows 2008 R2, both fresh installs. One machine has just .net 2.0 and .net 4.0. The other .net 2, 3, 3.5 and 4.
I am a local admin on each of the machines.
I have also tried the 64bit installer but get the following error, so I think the 32 bit one is the one to use.
System.BadImageFormatException
Any guidance would be appreciated. Thanks.
Another reason for this error might be that you copied your program from a source which windows considers untrusted.
You can unblock the assembly by clicking "unblock" after you right-click and select properties on the file.
Need to unblock files. or at least that's what fixed mine.
To do 'bulk' unblock in Powershell
get-childitem *.* | Unblock-File
or in DOS:
FOR %a in (*.*) do (echo.>%a:Zone.Identifier)
When we copy executable from another computer, Windows mark a flag on them for protection. Right Click on executable and in properties Click Unblock. It would clear flag and service executable would Install.
This issue came about for me because I was trying to install the service from a network location. By copying the service.exe to the local machine prior to using installutil, it fixed my problem and the service installed successfully.
don't forget to vote up...
Try the SC as follows:
1. open command line
2. write the below-
sc create ServiceName BinPath= "ExePath".
report on results...
I also faced the same issue. In my case I was deploying new version of utilities , i copied new exe , installog files and then trying to uninstall the utils.
I copied back the old version , uninstal the utils , copied the new version and installed it again. Anyway it is the logical sequence I should have followed in first place.
i have this issue and it for different between of .net version of util and my service
i use util for .net 2 and my service build with .net4
In my case this error was caused by accidentally passing the directory containing the service to InstallUtil instead of passing the service exe.
Obviously human error but I found the error message quite misleading.
you can use this command in developer command prompt run administrator
installutil C:\...\MyService\bin\Debug\MyService.exe
As per #doublehelix's response above, this answer put me on track for my particular issue which related to a service issue running in Windows XP (Unblock is not an option in the security tab that I could find). In my case I was attempting to run a service from a separate drive (i.e. not on the same drive as Windows and not under program files) although the actual physical disk was the same. Moving my service into the Program Files folder solved my underlying issue. (I intended to 'comment' against #doublehelix's answer but I don't seem to be able to in my current status).
Simply right click on your service files and select properties and then check the unblock checkbox
https://brianseekford.azurewebsites.net/2011/07/13/hresult-0x80131515-when-running-installutil-to-install-a-net-service/
Unblocking files did the job here. Weird thing is that the blocked files came from a signed installer run with admin privileges. Had to unblock several files in several folders at once.
I used the following registry tweaks to add context menus to a folder or file when Shift + right-click is pressed (it doesn't show up if just right-clicked).
Credits and references to the author in each code block.
Folder tweak:
Just save it as ShiftUnblockFolder.reg and import into Registry.
Windows Registry Editor Version 5.00
; Created by: Shawn Brink
; Created on: March 17th 2019
; Tutorial: https://www.tenforums.com/tutorials/129101-add-unblock-file-context-menu-windows-10-a.html
[HKCR\Directory\shell\unblock]
"MUIVerb"="Unblock"
"Extended"=""
"SubCommands"=""
[HKCR\Directory\shell\unblock\shell\001flyout]
"MUIVerb"="Unblock files only in this folder"
[HKCR\Directory\shell\unblock\shell\001flyout\command]
#="powershell.exe get-childitem -LiteralPath '%L' | Unblock-File"
[HKCR\Directory\shell\unblock\shell\002flyout]
"MUIVerb"="Unblock files in this folder and subfolders"
[HKCR\Directory\shell\unblock\shell\002flyout\command]
#="powershell.exe get-childitem -LiteralPath '%L' -recurse | Unblock-File"
Single file tweak:
ShiftUnblockFile.reg
Windows Registry Editor Version 5.00
; Created by: Shawn Brink
; Created on: March 17th 2019
; Tutorial: https://www.tenforums.com/tutorials/129101-add-unblock-file-context-menu-windows-10-a.html
[HKCR\*\shell\unblock]
"MUIVerb"="Unblock"
"Extended"=""
[HKCR\*\shell\unblock\command]
#="powershell.exe Unblock-File -LiteralPath '%L'"
[HKCR\Directory\shell\unblock]
"MUIVerb"="Unblock"
"Extended"=""
"SubCommands"=""
[HKCR\Directory\shell\unblock\shell\001flyout]
"MUIVerb"="Unblock files only in this folder"
[HKCR\Directory\shell\unblock\shell\001flyout\command]
#="powershell.exe get-childitem -LiteralPath '%L' | Unblock-File"
[HKCR\Directory\shell\unblock\shell\002flyout]
"MUIVerb"="Unblock files in this folder and subfolders"
[HKCR\Directory\shell\unblock\shell\002flyout\command]
#="powershell.exe get-childitem -LiteralPath '%L' -recurse | Unblock-File"
You can try to make a Setup Project for your service and run the MSI file on that server.