"Crypto settings changed" message shown when launching an Azure Cloud Service locally - c#

I’m getting the following behavior when I try to launch an Azure Cloud Service locally
1) Popup that the debugging environment is getting ready is shown (step1.jpg)
2) Message “Your about to be signed out, crypto settings changed” is shown (step2.jpg)
3) Force restart of the notebook is performed (step3.jpg)
This is happening constantly in both debug and start without debugging options.
I tried changing the properties of the azure cloud service but it didn’t help. I also tried to use the internet what does this message mean and could not find any relevant data. appreciate ANY help. Thanks!

Check you ServiceDefinition.csdef for startup tasks. I think you maybe running the DisableSslv3.cmd script on your local machine causing it to force a restart. Just comment out the line while debugging locally.

In addition to the answer of #user2282308, I would say that in a more global approach, it worth to check the startup tasks in the serviceDefinition.csdef and verify that all tasks are executed as "expected".
#user22822308 spoke about DisableSslv3.cmd, but on my side, the issue was that the script runTLSsettings.cmd should be executed only when running on Azure service (this script ends with a reboot of the machine and the famous "crypto settings changed")
This is the serviceDefinition.csdef integration that is proposed by Microsoft for the runTLSSettings script:
<Startup>
<Task executionContext="elevated" taskType="simple" commandLine="RunTLSSettings.cmd">
</Task>
</Startup>
This is ok when debugging your cloud service in Visual Studio 2019, but as soon as you try to debug with Visual Studio 2022 you will receive the "Crypto settings changed".
My feeling is that the startup task is not done in VS 2019 meanwhile it is done in VS 2022.
Thus, what is missing is the definition of the environment variable that indicate to runTLSSettings script if we are running on emulator or not.
The environment variable definition is well explained in this other microsoft documentation:
https://learn.microsoft.com/en-us/azure/cloud-services/cloud-services-startup-tasks#environment-variables
At the end, this is the correct csdef:
<Startup>
<Task commandLine="runTLSSettings.cmd" executionContext="limited" taskType="simple">
<Environment>
<Variable name="ComputeEmulatorRunning">
<RoleInstanceValue xpath="/RoleEnvironment/Deployment/#emulated" />
</Variable>
</Environment>
</Task>

This happens every single time I run Visual Studio without elevated privilege's. When I start debugging the cloud service and the azure emulator starts, I get this message and the computer reboots.

Related

Msi setup showing File in use message on uninstallation

I have developed an msi setup using WIX which consists of a desktop application as well as a windows service and both are running on C# .Net 3.5 framework. My windows service starts only when any user logs into the system which triggers the desktop application to start. The windows service is made to run as Local System. The msi setup is getting installed successfully at Win-8, Win-7 and Windows-XP but showing "File In Use" message while doing uninstallation even the service is not removed from the SCM. I have given the below codes at the OnStop() method of the service and inside the WIX page respectively.
onStop() method:
Process[] workers = Process.GetProcessesByName("filename");
workers[0].WaitForExit(1000);
workers[0].Kill();
workers[0].Dispose();
workers[0].Close();
Product.wxs inside WIX:
<ServiceInstall Id="ServiceInstaller" Name="Servicename"
DisplayName="service display name" Description="service description"
Start="auto" Account="LocalSystem" ErrorControl="normal"
Type="ownProcess"></ServiceInstall>
<ServiceControl Id="ServiceInstallerControl" Name="Servicename"
Start="install" Stop="both" Remove="uninstall" Wait="yes" />
The service is not removed from the SCM at all and the below popup message is displaying at the time of uninstallation process.
I have worked around with the WIX to solve the problem but unable to do so.
Any kind of help in this regard will be highly appreciated.
I'd recommend you to create custom action that handles the uninstall.You can create a batch file with the uninstall details , and then simply execute the batch file from the custom action( as a process).Its good practice to create installation and uninstall batch files with your service.

Can't get NServiceBus running under custom service account?

I've created a bare-bones NServiceBus endpoint (which doesn't do anything for now), and when I install it (using NServiceBus.Host.exe /install /displayName:"MyEndpoint"), it gets installed as a service
that runs under Local Service, and it works perfectly.
Now, when I change the Run as account for this Windows Service to my own local service account (lets call it "svcTestAccount" for now, it has Logon as a service permission), the service starts and then unexpectedly stops halfway during its initialization.
I can't tell why, since no exceptions get logged to log4net, the process just terminates.
I've seen this behaviour before in a previous project when the endpoint couldn't access the queue it needed, but this time I have configured the 5 queues that my endpoint to give "Everyone" "Full Control", so it shouldn't be that, right?
What's strange is that, when I run it (using the NServiceBus.Host.exe on production profile), it happily runs in all the following situations:
From within Visual Studio 2012, running as local admin.
As a windows service, running under Local Service
As a windows service, running under Network Service
As a windows service, running under svcTestAccount, if svcTestAccount is a member of the local Administrators group.
From a command prompt running under svcTestAccount (i.e. "runas /user:svcTestAccount cmd" to open the command prompt, then NServiceBus.Host.exe to run my endpoint)
The only thing that doesn't work is getting it to run as a Windows Service under svcTestAccount (and not being a member of the local Administrators group).
Can anybody tell me what's going on?
For completeness sake, my endpoint only consists of:
public class EndpointConfig : IConfigureThisEndpoint, AsA_Publisher, IWantCustomInitialization
{
public void Init()
{
Configure.With()
.DefaultBuilder()
.Log4Net();
}
}
And my web.config:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<configuration>
<configSections>
<section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" />
</configSections>
<UnicastBusConfig>
<MessageEndpointMappings>
</MessageEndpointMappings>
</UnicastBusConfig>
</configuration>
I'm using NServiceBus 4.3.0 on Windows Server 2012.
To run NServiceBus host as a different account (not Local System) you need to execute the installer with /username and /password, eg:
NServiceBus.Host.exe /install /displayName:"MyEndpoint" /username:"mydomain\username" /password:"mysecretpassword"
See http://docs.particular.net/NServiceBus/the-nservicebus-host#installation for more info.

visual studio 2012 debug for asp.net not working using IIS7

I can´t run visual studio 2012 debug for asp net using IIS7.
I have already tried the following
ASP NET Settings in IIS
.NET Compilation: Changed Default Language to c#
IIS Settings
ASP:
Changed script Language to c# (manually)
Enable Client-side debugging: true
Enable Server-side debugging: true
Script
- Language: c#
Also I am using Asp Net v4.0 app pool
Is there any other settings I can change to try make it work?
EDIT:
My user is part of Debbuger Users
The error is the following:
Unable to start debbuging on the web server. The web server is not configured correctly. See help for common configuration erros.
EDIT 2:
This is the log
Software: Microsoft Internet Information Services 7.5
Version: 1.0
Date: 2012-12-18 11:29:55
Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status time-taken
2012-12-18 11:29:55 ::1 DEBUG /tgpwebged/debugattach.aspx - 443 - ::1 - 403 7 5 43
EDIT 3:
I have manually configured the compilation element in web.config. This is the actuall config:
<compilation batch="true" debug="true" defaultLanguage="C#" explicit="false"
maxBatchGeneratedFileSize="10000" maxBatchSize="10000"
numRecompilesBeforeAppRestart="100" strict="false"
tempDirectory="C:\Windows\Temp" urlLinePragmas="false"> </compilation>
Also just for test purpose changed the user ASP NET V4 app pool runs under to my account. Not the SYSTEM.. my personal account. No success yet.
I have had this issue before (although not with VS2012) and the following things have worked:
Ensure IIS is configured for Integrated Windows Authentication.
Make sure HTTP Keep Alives are enabled.
Make sure http://localhost is in your trusted sites in your web browser.
Can you attach your debugger to the w3wp process and debug that way ?
Here is an article: Attatch debugger to an IIS process
Try to run the following in the command line:
cd %windir%\Microsoft.NET\Framework\v4.0.30319
aspnet_regiis.exe -i
Typically you have to run Visual Studio as a local administrator for debugging to work.
I'm running into something similar on VS2010 with a site hosted on IIS7.5. I'm trying to hit F5 and get my website to start up an automatically attach a debugger.
I think the key is this line in your log:
2012-12-18 11:29:55 ::1 DEBUG /tgpwebged/debugattach.aspx - 443 - ::1 - 403 7 5 43
As far as I know, debugattach.aspx is some sort of hook that VS will try to invoke before it can actually start up and run your app. Details are a bit sketchy on the interwebs about what this thing actually is, however it does seem that if you don't get a 200 (success) VS won't be able to automatically attach. Basically it fails on step 1. In your log, you have a 403 (authorization error) for this request, I have a 404 (not found) in my log.
In your specific case, you might have something in your IIS config that's blocking the DEBUG verb. It's a common security practice to block uncommon verbs or anything other than POST and GET. In my case, it's probably similar - the aspx extension is probably being filtered out. It could also be the default authentication settings for the app in question.
Update: I did solve this on my end, and two separate things were wrong. First, I was using UrlScan.dll for security and it was blocking the DEBUG verb. Also, I was using a UrlRewrite rule to go from HTTP to HTTPS and the 302 redirect it generated also blocked this VS request. I was able to find both issues using the IIS Failed Request Tracing feature. The logs from that tool give some insight on what various modules and handlers in the pipeline are doing.
Hopefully this helps!
I've just had the same situation. I have solved it and here's how I did it:
Check if it's the right .NET Framework edition on the IIS.
Check your application pool's pipeline mode, for some apps - it only allows Classic mode.
Check if there's any other application under the application which you want to debug.

Upgrading to NServiceBus 3.2.2 exception when starting endpoint

I recently upgraded my publisher/subscriber solution to NServiceBus version 3.2.2 using Nuget. My NServiceBus publisher and subscriber are both self-hosted.
Publisher code:
I start the NServiceBus publisher using NServiceBus.Host.exe (debug start action - start external program in project property).
app.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="MsmqTransportConfig" type="NServiceBus.Config.MsmqTransportConfig, NServiceBus.Core" />
<section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" />
<section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" />
</configSections>
<MsmqTransportConfig ErrorQueue="error" NumberOfWorkerThreads="1" MaxRetries="5" />
<UnicastBusConfig ForwardReceivedMessagesTo="">
<MessageEndpointMappings></MessageEndpointMappings>
</UnicastBusConfig>
<MessageForwardingInCaseOfFaultConfig ErrorQueue="error" />
</configuration>
EndpointConfig.cs:
namespace TrackEventPublisher.EventPublisher
{
[EndpointName("EventPublisher")]
public class EndpointConfig : IConfigureThisEndpoint, AsA_Publisher
{
}
}
I ran into the following error when running the publisher:
Exception when starting endpoint, error has been logged. Reason: An exception was thrown while invoking the constructor 'Void .ctor(Raven.Client.IDocumentStore)' on type 'RavenTimeoutPersistence'.
StackTrace:
at NServiceBus.Hosting.GenericHost.Start() in d:\BuildAgent-03\work\nsb.master22\src\hosting\NServiceBus.Hosting\GenericHost.cs:line 45
at NServiceBus.Hosting.Windows.WindowsHost.Start() in d:\BuildAgent-03\work\nsb.master22\src\hosting\NServiceBus.Hosting.Windows\WindowsHost.cs:line 56
at NServiceBus.Hosting.Windows.Program.<>c_DisplayClass8.b_4(WindowsHost service) in d:\BuildAgent-03\work\nsb.master22\src\hosting\NServiceBus.Hosting.Windows\Program.cs:line 95
at Topshelf.Internal.ControllerDelegates1.StartActionObject(Object obj) in d:\dev\open-source\topshelf\src\Topshelf\Internal\ControllerDelegates.cs:line 18
at Topshelf.Internal.IsolatedServiceControllerWrapper1.<>c_DisplayClass2.b_1(TService service) in d:\dev\open-source\topshelf\src\Topshelf\Internal\IsolatedServiceControllerWrapper.cs:line 65
at Topshelf.Internal.ServiceController1.<.cctor>b__1(ServiceController1 sc) in d:\dev\open-source\topshelf\src\Topshelf\Internal\ServiceController.cs:line 35
at Magnum.StateMachine.LambdaAction1.Execute(T instance, Event event, Object parameter) in :line 0
at Magnum.StateMachine.EventActionList1.Execute(T stateMachine, Event event, Object parameter) in :line 0
What might cause this error?
Can anyone tell me what is wrong with my endpoint configuration?
My solution worked great with an earlier version of NServiceBus (pre version 3.0).
Update:
Here is the inner exception message: "Unable to connect to the remote server"
Is the Raven server started automatically by NServiceBus? It would appear that it is not running on my machine...
Update
Well, for some reason the RavenDB service was not running on my machine - although it is set to start automatically. My solution is working correctly now. I guess I had to learn about the RavenDB the hard way :).
Has anyone out there had problems running the RavenDB service?
Update
Now that I have my service up and running, I try and run it on a different machine. The msmq folders are not created, and I get an error that the RavenDB is not available. In fact, RavenDB service is not installed after I ran my solution on a different windows OS machine. I tried running the "RunMeFirst.bat" that posted with version 3.2.2. However, the bat file attempts to install an extension with visual studio. Another error is posted if visual studio is installed, but Nuget extension is not installed.
Is there a better way to enable NServiceBus.Host.exe to install the RavenDB server and msmq folders without an instance of visual studio installed on the Windows OS machine?
Update
Wow, most updates ever! I added the following class to my publisher project which successfully created the msmq folders:
class MsmqTransportConfigOverride : IWantCustomInitialization, INeedToInstallInfrastructure<Windows>
{
public void Init()
{
Configure.Instance.ForInstallationOn<NServiceBus.Installation.Environments.Windows>().Install();
}
public void Install(System.Security.Principal.WindowsIdentity identity)
{
}
}
This new class which implements the IWantCustomIntialization interface seems to work great. However, I am still struggling to update my publisher to install the RavenDB on the windows host machine. I know there is a commandline prompt out there that can facilitate this, but is there another way? I tried to implement INeedToInstallInfrastructure interface, but I cannot find any examples out there. Does anyone have any ideas?
We only run the installers if you:
1. Install the endpoint as a windows service (if running in the production profile => the default)
2. Run in debug mode
3. Run in the integration/lite profiles
So that would explain why the queues are not created (assuming none of the above is true for you?)

debugging a HTTP Handler

I am using IIS 6 on 2003. I have created a HTTP handler dll that inherits from IHttpAsyncHandler. The dll builds into the inetpub\www8080root\common\bin directory. It is meant to intercept all requests.
The web site is set to monitor port 8080. I have created a common folder in the www8080root directory and have created a virtual directory in II6 to point to it.
I created a web.config file in the common directory
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation debug="true" defaultLanguage="c#" />
<httpHandlers>
<add verb="*" path="*"
type="x2Handler.x2Handler, x2Handler" />
</httpHandlers>
</system.web>
</configuration>
When I access http://localhost:8080/common/index.html the HTTP handler causes a crash of w3wp.exe, when I look in the event logs I can see the error within the handler that caused the crash. When I set a breakpoint within VS 2005 the code it doesn't get hit.
In order to debug I need to somehow attach to the process when it is running under IIS but as soon as it processes a request, it crashes.
How do I debug a HTTP Handler dll under IIS? I can't see a aspnet_wp.exe process to attach to as described here: C#, Debugging an HTTPHandler
EDIT:
By adding Debugger.Break() I now receive the message "w3wp.exe has triggered a breakpoint" and it allows me to select a debug environment, but it loads without symbols
No symbols are loaded for any call stack frame. The source code cannot be displayed.
I set Tools->Options->Debugging->Enable Just My Code
I set the path to the common/bin location to load symbols from. Any manually set breakpoints still display:
The breakpoint will not currently be hit. No symbols have been loaded for this document.
EDIT:
When it loads it appears to be looking for the symbols of ntdll.pdb. Even if I manually load the symbol file for the httpHandler it makes no difference.
The code is definitely executing though.
Add Debugger.Break() a few lines before the exception occurs. This should give you a popup asking to attach a debugger.
The problem was that .Net had been installed prior to the version IIS. I had noticed the "Edit configuration" button was disabled and found this site http://www.warfiblog.com/edit-configuration-disabled.
Following the instructions:
You will need to go to Start -> Microsoft Visual Studio 2005 -> Visual Studio Tools -> Visual Studio 2005 Command Prompt. On the prompt write down this command:
aspnet_regiis -r
The above command will register dot net with IIS and now the button will also be enabled.
In doing that it fixed the debugging issue!

Categories

Resources