If you are getting this error:
Wednesday, February 24, 2021
How to fix error “ANCM In-Process Handler Load Failure”?
Wednesday, February 3, 2021
How can I call an async method in Main?
{
class Program
{
private static string result = "123";
static void Main(string[] args)
{
Console.WriteLine(data.Result);
Console.Read();
}
static async Task<string> saytest()
{
await Task.Delay(5);
result = "Hello World";
return result;
}
}
}
Tuesday, February 2, 2021
Unable to connect to the remote server at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync
Unable to connect to the remote server at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync
Error:
Full error is as below, while generating reports in Developer VM.
Unable to connect to the remote server at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext) at Microsoft.WindowsAzure.Storage.Table.CloudTable.Exists(Boolean primaryOnly, TableRequestOptions requestOptions, OperationContext operationContext) at Microsoft.WindowsAzure.Storage.Table.CloudTable.CreateIfNotExists(TableRequestOptions requestOptions, OperationContext operationContext) at Microsoft.DynamicsOnline.Infrastructure.Components.TableAccessor.TableStorageAccessor.PerformOperation(CloudStorageAccount storageAccount, String tableName, Func`1 operation) at
Reason:
Azure emulator service is not running due to port conflict with another windows service.
How to find what is running on what port?
using any of the below commands in cmd will give you list of the ports used by services.
netstat -bano
netstat -a
In my case, those ports were in use by windows application, which i can not stop or change port.
How to solve error?
To resolve this error open CMD with Administrative privileges
Navigate to location: "C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\"
Execute command AzureStorageEmulator.exe start.
In my case service was not started due to same ports were being used by another application.
I have changed port number for Azure Emulator to run on different port and started service.
Below is Picturization for the same.
Thank you .
Upload Image To Azure China Blob Storage In ASP.NET MVC
<appSettings>
<add key="StorageAccountName" value="YOURAZURECHINAACCOUNTNAME" />
<add key="StorageAccountKey" value="YOURAZURECHINAACCOUNTKEY" />
</appSettings>
The below is controller code
I am using service here the code are as below:-
using Microsoft.Azure;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Auth;
using Microsoft.WindowsAzure.Storage.Blob;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
namespace BlobStorageDemo
{
public class ImageService
{
public async Task<string> UploadImageAsync(HttpPostedFileBase imageToUpload)
{
string account = CloudConfigurationManager.GetSetting("StorageAccountName");
string key = CloudConfigurationManager.GetSetting("StorageAccountKey");
string imageFullPath = null;
if (imageToUpload == null || imageToUpload.ContentLength==0)
{
return null;
}
try
{
StorageCredentials credn = new StorageCredentials(account, key);
CloudStorageAccount cloudStorageAccount = new CloudStorageAccount(credn, new Uri("https://deice2staging.blob.core.chinacloudapi.cn "),
new Uri(" https://deice2staging.blob.core.chinacloudapi.cn/ "),
new Uri("https://deice2staging.blob.core.chinacloudapi.cn/ "), null);
//CloudStorageAccount cloudStorageAccount = ConnectionString.GetConnectionString();
CloudBlobClient cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient();
CloudBlobContainer cloudBlobContainer = cloudBlobClient.GetContainerReference("blobstor1");
if(await cloudBlobContainer.CreateIfNotExistsAsync())
{
await cloudBlobContainer.SetPermissionsAsync(
new BlobContainerPermissions {
PublicAccess = BlobContainerPublicAccessType.Blob
}
);
}
string imageName = Guid.NewGuid().ToString() + "-" + Path.GetExtension(imageToUpload.FileName);
CloudBlockBlob cloudBlockBlob = cloudBlobContainer.GetBlockBlobReference(imageName);
cloudBlockBlob.Properties.ContentType = imageToUpload.ContentType;
await cloudBlockBlob.UploadFromStreamAsync(imageToUpload.InputStream);
imageFullPath = cloudBlockBlob.Uri.ToString();
}
catch (Exception ex)
{
}
return imageFullPath;
}
}
}
and my UI code are as below :-
@{
ViewBag.Title = "Upload";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Upload Image</h2>
<br />
@using (Html.BeginForm("Upload", "Image", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<fieldset class="form-horizontal">
<div class="form-group">
<label class="control-label col-md-2" for="Photo">Photo</label>
<div class="col-md-10">
<input type="file" name="photo" />
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Submit" class="btn" />
</div>
</div>
</fieldset>
}
Thank you .
Hope it is help you
Thursday, September 10, 2020
Sign out azure in vs code
I was using an app service in Visual Studio Code to access a certain set of subscriptions I was working against and deploying to. This was prior to getting my pipelines ready, as that was my eventual deployment destination. In the meantime, I needed to sign out the account and noticed there wasn’t any GUI way to do this in the Azure extension (that I could find anyway). I did some looking and found the process:
Start by opening the Command Palette:
Thursday, July 30, 2020
Get an Invalid or Expired Token Error Response in postman for twitter api
Solution: Check the authorization for your application on the Twitter developer page and update the credentials for the adapter.
Log in to the Twitter developer page and go to https://apps.twitter.com.
If you have revoked access to the application, provide access by clicking Generate Access Token.
Make a note of the following tokens in the Keys and Access Tokens tab:
Consumer key
Consumer secret
Access token
Access token secret
Update the Twitter Adapter connection with these credentials.
Wednesday, June 17, 2020
How to Install NVM on Windows
Go to below URL.
https://github.com/coreybutler/nvm-windows
Click on Download Now
Extract the nvm-setup.zip file.
when you extract the file you will get nvm-setup.exe.So install this exe file in your system.
Go to start men type Git bash
Thank you hope it is help you.
