Trying detect image Values using Google Cloud Vision using c# asp.net c#

Trying detect image Values using Google Cloud Vision using c# asp.net c# but i am getting below error.

Error loading native library. Not found in any of the possible locations: C:\Users\mazharkhan\Documents\Visual Studio 2013\WebSites\googleapi\bin\grpc_csharp_ext.x86.dll,C:\Users\mazharkhan\Documents\Visual Studio 2013\WebSites\googleapi\bin\runtimes/win/native\grpc_csharp_ext.x86.dll,C:\Users\mazharkhan\Documents\Visual Studio 2013\WebSites\googleapi\bin\../..\runtimes/win/native\grpc_csharp_ext.x86.dll

I am getting error in below line. And tried to open this url is not working: http://vision.googleapis.com

var channel = new Grpc.Core.Channel(@"http://vision.googleapis.com", credential.ToChannelCredentials()); // <-- Getting error in this line 

Below is my design code.

<form id="form1" runat="server">
<div>
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
    <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
</form>

Below is my code which worte in button click for display in label

protected void Button1_Click(object sender, EventArgs e)
{
    var image = Google.Cloud.Vision.V1.Image.FromFile(@"C:\!\cat.jpg");
    var credential = GoogleCredential.FromFile(@"C:\!\Tutorials-0a2efaf1b53c.json");
    var channel = new Grpc.Core.Channel(@"http://vision.googleapis.com", credential.ToChannelCredentials()); // <-- Getting error in this line 
    var client = ImageAnnotatorClient.Create(channel);
    var response = client.DetectText(image); 
    foreach (var annotation in response)
    {
        if (annotation.Description != null)
            //    Console.WriteLine(annotation.Description);
            Label1.Text += annotation.Description + "\r\n";

    }

}

I used below example url:

Detecting content in Google Cloud Vision for .NET does nothing/hangs app

I created service key account also in google for json file.

enter image description here

Jon Skeet
people
quotationmark

This error isn't really about the Vision API, or authentication - it's due to gRPC not loading properly. It sounds like you're using a "Web Site" project rather than a "Web Application" project. This is a known issue - there's a workaround of copying the relevant library into the bin directory at execution time before starting to use gRPC, but I'd advise against that.

I'd advise using a Web Application project instead, if you possibly can.

people

See more on this question at Stackoverflow