I'm developing a program that uses System.Management.Automation library so I can create an instance of PowerShell. Something like:
using (var instance = System.Management.Automation.PowerShell.Create())
{
// do something
}
In order to avoid forcing the user to have PowerShell v3 installed, I'm using System.Management.Automation Nuget package version 6.3.9600.17400. When testing on my machine, I'm getting the following error:
An error occurred while attempting to load the system Windows PowerShell snap-ins. Please contact Microsoft Customer Support Services. ---> System.Management.Automation.PSArgumentException: Unable to access Windows PowerShell PowerShellEngine registry information.
I'm lost on this. Right now, I'm trying to install PowerShell v3 on my machine to see if it works. I really thought having the package would work. Is there something I can do?
Thanks in advance
Well, I gave up using PowerShell v3 and I'm using v1 instead.
So I referenced System.Management.Automation.dll from:
C:\Windows\assembly\GAC_MSIL\System.Management.Automation.
I've been able to use the needed Snap-Ins so far
Related
im using Application Insight Codeless Attach over IIS with Status Monitor v2.
Everything works great, the only thing is that im not able to see SQL CommandText over the insights.
In addition to the platform specific steps above, you must also
explicitly opt-in to enable SQL command collection by modifying the
applicationInsights.config file with the following:
The application folder does not have any applicationInsights.config file so is not possible to add the following:
<EnableSqlCommandTextInstrumentation>true</EnableSqlCommandTextInstrumentation>
I've also tried to change the ApplicationInsights-default.config and ApplicationInsights-recommended.config files under "ApplicationMonitor\version\content\runtime" without success.
Does somebody know how to add this property without code implementation?
As this doc mentioned, IIS server need to use Microsoft.Data.SqlClient instead of System.Data.SqlClient.
requires using the instrumentation engine or by using the
Microsoft.Data.SqlClient NuGet package instead of the
System.Data.SqlClient library
===========================Test result=====================
I created a test asp.net core mvc app and used Microsoft.Data.SqlClient, after deploying to azure web app and enable application insights, I can see sql query text like below.
I get it working without using Microsoft.Data.SqlClient and without a single line of code in the application. Just using status monitor v2, enabling instrumentation and adding -connectionstring instead of -instrumentationkey or -instrumentationkeymap. The problem with this approach is that when you deploy an app looks like the instrumentation service stop getting the sqlcommandtext until you restart it –
I've been trying for days to migrate our backend solution running on Azure 2.6 and Azure Cloud Services to Azure 2.7 in VS2015 on Windows 10 workstation, but without any luck.
I've tried on multiple computers using a clean install of Windows 10 Pro x64 with Visual Studio 2015 Enterprise (all features installed).
All updates available in both Windows Update and Vs2015 are installed.
I create a new Cloud Service solution, with one Empty web role.
I've set VS2015 to break on "Common Language Runtime Exceptions" (Debug -> Windows -> Exception Settings).
I've run into the same errors on a separate machine running Win 8.1, VS2015, Azure 2.7.
The solution compiles fine but when I try to run/debug the Cloud Service project it throws the following error:
Exception thrown: 'System.Security.SecurityException' in mscorlib.dll
Additional information: Requested registry access is not allowed.
Starting only the WebRole without using the CloudService works.
When I try to run the CloudService through VS2015 with administrator priviliges the following exception is thrown:
'System.Threading.WaitHandleCannotBeOpenedException' in mscorlib.dll
Additional information: No handle of the given name exists.
Publishing the compiled solution to Azure yeilds the same exception when inspecting the intellisense logs ("Requested registry access is not allowed").
I've tried to add the install.cmd script from this blog post to install 4.5.2 or 4.6 on Azure Cloud Service when deploying but without any change in result: https://azure.microsoft.com/en-us/documentation/articles/cloud-services-dotnet-install-dotnet/
Are Cloud Services compatible with Azure 2.7?
-- UPDATE: Yes. Make sure you use .Net framework v4.5.1
Is the install.cmd script really needed when running in local debug mode? Both 4.5.2 and 4.6 should already be installed, right?
Anyone else experiencing problems with this?
Any help or hints on how to get Cloud Services to work with Windows10, Vs2015 and Azure 2.7 are greatly appriciated!
Here is a repo with a sample project: https://www.dropbox.com/s/ie7jcn932nsddio/CloudServiceRepo.zip?dl=0
If your underlying cause is the same as mine, I have a workaround (if not an actual cause and solution)
Add this under the runtime -> assemblyBinding section of the app.config for your worker role:
<dependentAssembly>
<assemblyIdentity name="Microsoft.WindowsAzure.Diagnostics" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.7.0.0" newVersion="2.7.0.0" />
</dependentAssembly>
Here's how I arrived at this. In VS2015 with SDK 2.7, I created a brand-new, empty cloud service. I pulled in my existing worker role, which was created with SDK 2.6 and upgraded to 2.7. This time, I got a new error complaining that it could not find Microsoft.WindowsAzure.Diagnostics version 2.6. In my worker role, my assembly reference is for version 2.7, not 2.6. So, something in the worker role (which I cannot find or understand) still wants version 2.6 of this assembly. Bad upgrade by the SDK? Dunno. Anyway, by adding this entry in the app.config, I force it to use version 2.7 instead.
I don't know why I get a different (and more accurate) error message when I create a new cloud service, versus using the old one. I also don't know what this has to do with the original "WaitHandle" error, but perhaps that was a red-herring, and the original problem has always been a version mismatch? I'd like to know what caused this problem and what the proper long-term solution is, but I'll settle for this workaround for now.
Good luck, I hope this works for you as it did for me.
I am newbie in Microsoft Azure so I tried to create some easy chat for learning purpose. I found nice tutorial:
http://www.asp.net/signalr/overview/performance/scaleout-with-windows-azure-service-bus
I did everything as it is in this sites.
When I try to deploy project on server, I get error:
The file provided is not a valid service package. Detailed error code: TestWebRole Invalid application runtime - a runtime component is missing:/base/x64/IISConfigurator.exe.
So I was looking for IISConfigurator.exe file in computer and I found it in that project. It's in path:
projectName/csx/Release/roles/projectName/base/x64/IISConfigurator.exe.
This file exists but it's on wrong place most likely.
I tried to put it all over the places in project, but nothing changed.
I tried to put it in system path, but this didn't help as well.
I am currently using Visual studio 2013 Community edition with admin rights.
Whole history for deploy:
16:40:22 - Applying Diagnostics extension.
16:40:42 - Preparing deployment for TestProject - 3. 4. 2015 16:40:14 with Subscription ID '9ca25534-0b9c-4b17-b259-e32d19977b7a' using Service Management URL 'https://management.core.windows.net/'...
16:40:42 - Connecting...
16:40:42 - Verifying storage account 'wa2chatstorage'...
16:40:42 - Uploading Package...
16:40:48 - Creating...
16:41:19 - The file provided is not a valid service package. Detailed error code: TestWebRole Invalid application runtime - a runtime component is missing:/base/x64/IISConfigurator.exe.
I saw this issue as well, but with a much scaled down version of what you're trying to do.
https://azure.microsoft.com/en-us/documentation/articles/powershell-install-configure/
I installed the latest SDK (2.7) and the PowerShell updates and it worked like a charm. Hope that helps!
I had an issue in our TeamCity servers with that error message in it:
Set-AzureDeployment : BadRequest : The file provided is not a valid service package. Detailed error code: [MyProject] Invalid application runtime - a runtime component is missing:/base/x64/IISConfigurator.exe.
The fix for me was to uninstall Microsoft Azure Authoring Tools - v2.9.6 and Microsoft Azure Authoring Tools - v2.9 from the build agent (which removed "C:\Program Files\Microsoft SDKs\Azure.NET SDK\v2.9\bin\runtimes\base\x64\IISConfigurator.exe"), and then reinstall the Microsoft Azure Authoring Tools - v2.9 from the Windows Azure SDK for .NET - 2.5 download.
We have a mixed (forms and Windows)-based SharePoint 2010 site and I'm attempting to use the object model in c# (command line console app, referenced to Microsoft.SharePoint, Solution Platform target is x64 [in VS 2012 I had to create a new solution platform, settings copied from <Empty>].)
In PowerShell, I can simply do something like
$site = Get-SPSite http://www.server.com/sites/site1
It successfully retrieves the object, and I can open the contained SPWebs, etc. as I please. However, when I attempt similar logic in C# (on the same box under the same user credentials) like
using(SPSite site = new SPSite("http://www.server.com/sites/site1") { }
it fails with the FileNotFoundException. Any attempts to use the associated Guids follow the same issue. Why might this be happening?
Also, I am an administrator on the box and also explicitly have sysadmin server role on the database.
I assume you are doing this in a command prompt? If so, please make sure you are compiling your project in x64. This is the error message I see when I compile my code in x86 or Any CPU.
For anyone experiencing this as well. PowerShell 3 does not support SharePoint methods. I discovered after installing Powershell v3 that I had to enter another shell using the command powershell -version 2 first before running SharePoint commands, which led me to realize that my VS project was targeting .NET 4.5; Once I changed it to .NET 3.5, everything worked.
I assume that despite the SharePoint libraries targeting .NET 3.5, and theoretically the .NET 4 CLR can handle .NET 2 CLR libraries, Projects with usage of SharePoint 2010 do not support targeting .NET 4/4.5 in any way.
Happy to be proved wrong, of course ;)
I'm trying to connect to QuickBooks Accountant 2011 using the usual QBFC classes (C#).
QBSessionManager sessionManager = new QBSessionManager();
sessionManager.OpenConnection("", "Application");
A I know, from Intuit samples the code above should connect to the opened instance of aQuickBooks application.
The error that I'm getting is:
Retrieving the COM class factory for component with CLSID {3C801F08-CDC5-4129-AAE8-CCC4F116B5BE} failed due to the following error: 80040154.
Yes, I've build the project using x86 as the target, but I guess I'm missing something. Do I need to install the QuickBooks SDK on the client computer? I'm using QB SDK 10, do I need to use QB SDK 11?
Please guide me in the right direction.
PS: I did another application that uses QBOE, which is working OK, but this time I'm stuck on trying things that don't make sense.
I found the issue. Seems like the client computer, that will be using the application needs to have installed the QuickBooks SDK. Should of tried that earlier :)
In the SDK, you get some installers for the redistributable binaries that resides at
C:\Program Files (x86)\Intuit\IDN\QBSDK11.0\tools\installers
According to the QB site, you can't do the redistribution any other way.