I was developing an Asp.Net web application that will execute particular PowerShell Commands for Office 365. The code contains two parts of the commands (Exchange Online and MSOnline Command). The code is working fine locally on my PC. But When I published the code into Azure Web App the Exchange Online Commands are working as I expected it, but MSOnline commands are giving the below error:
The term 'Connect-MsolService' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is
correct and try again.
I am sure that this error has raised because it did not find the matched MSOnline dlls files to import the module. I have added the dll's using Kudo but also the same. anyone have any idea how to solve this one.
Thank you always
Doing some reading here and here, it looks like you aren't allowed to install the prerequisites needed unless you upgrade (the answer in that second link describes that).
I have had to do this too: call PowerShell from C# for Office 365 administration, so I feel your pain :) although we host on a normal Windows server.
Related
I have an SSIS package which uses C# script and 3rd party libraries to perform the required task. The package executes fine from visual studio, however when I try to run the same as SQL job, I see a successful completion, however the task the script is expected to perform is not happening (The 3rd party dll methods appears to be ignored).
The SQL job is run using service account and for Visual studio it is with my windows user credentials.
Is it a credentials issue for the service user or a firewall issue, any suggestions which can direct me to a way forward will be greatly appreciated. Thanks.
One time, I faced a similar issue while using Microsoft.Office.Interop.Word.dll assembly, after spending my time trying to resolve this issue, I some functionalities require a Windows user to run without any error.
Try to add a proxy account (run SQL job with the same credentials use to run manually), you can follow one of these links for a step-by-step answer.
Running a SSIS Package from SQL Server Agent Using a Proxy Account
Create a SQL Server Agent Proxy
How do you load the reference to the 3rd party in your script?
I guess you are experiencing dll loading issue while running your code as a SQL Job.
Can you provide more details?
I am using PHP DOTNET class in my PHP code. I have registered the dll file in the GAC and the entire code works perfectly on localhost. But when uploaded to my Godaddy Linux Shared hosting, it doesn't work and gives a HTTP error 500.
On checking the error_log file I saw PHP Fatal error: Uncaught Error: Class 'COM' not found which (I think after some research) means that the COM_DOTNET class in not enabled in PHP.
I am using PHP version 7.1 on my Linux hosting.
Things I have tried
I have already tried to enable the COM_DOTNET extension from php.ini file.
I have also tried contacting Godaddy support but they can't seem to figure out what extension I am talking about and keep telling me that you can't run .net files on linux.
I have checked my phpinfo() as well can't seem to find the COM Class.
Another thing that I tried is going to CPanel Dashboard and tried to enable it through the list of PHP Extensions listed there. But can't seem to find it there as well.
After all this now I am thinking, can I use the DOTNET class on a Linux Hosting at all?
Or can it be only used on a windows hosting?
Does anyone know anything about this? Please help
We are migrating our previous MS Enterprise Bot applications (deprecated) to the new MS Virtual Assistant. The default template runs well on local with the Bot Emulator v4, but when i test it on Web Chat or in Microsoft Teams, we get an Unauthorized response.
There was an error sending this message to your bot: HTTP status code
Unauthorized
Using the deployed bot URL (https://your-proj-name.azurewebsites.net/api/messages) on the Bot Emulator, we get.
The bot's Microsoft App Id or Microsoft App Password is incorrect
I am lost in which because i am sure that i have the correct MS App Id and MS App Password, as we have been using it on our current Enterprise Bot deployments.
Is anyone having the same issue? Your suggestions are much appreciated.
I found the root cause of the problem.
As shown in the screenshot, the script prints out the following error message shortly after entering the passphrase.
'us#' is not recognized as an internal or external command,
And if you look at the passphrase I entered
K7=6HMCwE4&us#
you can already guess what has happened here.
Some characters in the passphrases seem to cause problems.
So far I have identified '&' and '#' as problematic characters.
Since the script finishes without any further error messages and everything else seems to work fine, it is not that obvious.
I ended up copying the latest ~/Deployment/Scripts (all files there) from the MS Virtual Assistant github repository. There were few recent updates there, and after doing so, tried the deployment using the latest patches, and everything worked fine.
I am not sure what part on the deployment script was failing, but using the recent fixes and updates did fix the issue I am encountering.
Hope this helps anyone who come across this issue.
Pre-requisites for deployment:
Go to https://www.luis.ai and create an app (skip if you already have one)
Copy your LUIS authoring key
Copy your LUIS location
Go to https://passwordsgenerator.net and generate a password, copy it
Do not create an Azure Resource Group, let the deployment do this for you
Steps for deployment (for initial deployment):
Empty out the values of each key for appsettings.json and cognitivemodels.json
Clean and rebuild the MS Virtual Assistant template project
Open (as administrator) your updated powershell (powershell core is required), and go to your project's location
On your powershell, run this command az login, enter your credentials and close the browser afterwards, a confirmation should display after then
On your powershell, run this command .\Deployment\Scripts\deploy.ps1, and enter the values for each parameter. Make sure you use the copied values from above for the specified parameters asked
Wait until the deployment completes
Steps for updating existing deployment:
Clean and rebuild the MS Virtual Assistant template project
Open (as administrator) your updated powershell (powershell core is required), and go to your project's location
On your powershell, run this command az login, enter your credentials and close the browser afterwards, a confirmation should display after then
On your powershell, run this command .\Deployment\Scripts\publish.ps1 -name YOUR_PROJECT_NAME -resourceGroup YOUR_PROJECT_RESOURCE_GROUP
All,
I created a C# console app in VS2010 (.NET4). that hits a database and sends out emails.
It works fine when I run it from VS but deploying the app to a remote server has me befuddled. All I need to do is install this app on (1) remote windows server.
Should be easy, right?
Looking at the publish settings, I don't see anything that will just build it locally without creating an installer (From a CD-Rom or DVD-ROM) and the other 2 options really don't apply either, at least by their descriptions.
So here is what I did so far:
The VS2010 publishing options that I am given are as follows:
Step #1 Picked option 3
Step #2 Place generated files on remote server
Step #3 Ran the setup installer
Step #4 Get this error
Question
Am I approaching this correctly?
If not, what do I need to do?
Thanks
Notice the error:
The application requires that assembly office Version 12.0.0.0 be installed in the Global Assembly Cache (GAC) first.
Refer to this answer and this MSDN question which contains the answer I have quoted below:
We solved it by going into the Applications Files dialog under the publish tab of the Project's properties and changing the office.dll assembly to Include. It had previously been set to prerequisite (auto). --Dave3182
It looks like your application is leveraging Microsoft Office (2003, I think) COM objects. This will require the same version of Office to be installed on your server.
If you are leveraging Office format files (.doc, .docx, .xls, .xlsx for example), you can look into 3rd party libraries that allow you to create the formatted files without Office installed. If you are just using Outlook to send the emails, you should re-implement the feature using the .NET libraries instead.
I am working on a SSIS Package using SQL Server 2012 and Visual Studio 2010 Shell.
I need to use a web method in a script task I have and I was able to run this script on windows 7 without any problems. This web service requires a certificate which I have installed in my personal computer store.
However when I moved this project into Windows Server 2008 R2, the package breaks for apparently no reason. I have no compilation errors on the Error List and if build the script task it will succeed, however when I finish editing the script a message box will appear with this error message:
"Scripts contained in the package have compilation errors. Do you want to save changes?"
If I remove the web reference from the script task, this message wont appear.
The package won't run because of this. I checked for error details on the Event Viewer, but it only shows "Package Failed" and no further details appear about this issue. Could this be related to a certificate issue? Is there an error log or way to know more details about what is causing the package to fail?
Thank you.
It isn't just the security issue of certificates required by the web service itself that you have to worry about.
The SSRS web server will not allow loading assemblies that are marked as "unsafe"--which is pretty much anything that does I/O. I once added a reference to a .Net Forms assembly to an SSRS report in order to use its rich text functionality. It worked beautifully in Visual Studio, but once deployed to the SSRS web server, it would never run. I am certain it could be made to function, but due to other priorities I actually gave up the job as everything I tried didn't work.
Searching online for adding custom assemblies yields some useful information for getting custom assemblies working. Here are some of the crucial steps:
Sign the assembly with a strong name, required because it is deployed to the GAC.
Use the assembly-level attribute [assembly:AllowPartiallyTrustedCallers] in the assembly so SSRS can use it.
A couple of likely resources are here and here.