Share via

I'm having difficulty connecting to my Azure File Share

KeithB 20 Reputation points
2023-06-09T14:27:18.1933333+00:00

I have an Azure Storage Account with a File share that I can successfully access from a WIndows File Explorer. I want to download these files via a web page.

using Azure.Storage.Files.Shares;
using Azure.Storage.Files.Shares.Models;
using System.IO;

connectionString = "DefaultEndpointsProtocol=https;AccountName=MyStorageAccountName;AccountKey=MyAccountKey;EndpointSuffix=core.windows.net";
// Instantiate a ShareClient which will be used to create and manipulate the file share
ShareClient share = new ShareClient(connectionString, "/MyFileShareName");
.
.
.

I get:

System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.'

I have:

I'm guessing this will be due to a wrong configuration or permission but I can't find it!

Azure Files
Azure Files

An Azure service that offers file shares in the cloud.

0 comments No comments
{count} votes

Answer accepted by question author
  1. KarishmaTiwari-MSFT 20,852 Reputation points Microsoft Employee Moderator
    2023-06-13T01:40:42.95+00:00

    @KeithB Thanks for posting your query on Microsoft Q&A.

    6/12/2023: I found a similar post on Stack overflow which suggests adding required NuGet references: https://stackoverflow.com/a/42704058

    Please try this and let me know the results.

    UPDATE 6/13/2023: Customer shared that updating the NuGet reference - System.Diagnostics.DiagnosticSource to latest version resulted in resolving the issue.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. KeithB 20 Reputation points
    2023-06-13T07:44:03.7433333+00:00

    I already had System.Net.Http. Another answer mentioned System.Diagnostics.DiagnosticSource. I updated that to the latest version and success!

    Many thanks for your help.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.