小编yon*_*sha的帖子

无法从程序集'Microsoft.WindowsAzure.Storage,Version = 4.3.0.0加载类型'Microsoft.WindowsAzure.Storage.Blob.CloudAppendBlob'

我正在Azure数据工厂中运行自定义活动,当我尝试使用CloudAppendBlob时,会发生以下异常.它看起来像版本问题,但无法找到解决方法.我使用Windows Azure Storage 7.0.0编译了代码.请帮忙!

模块中的未知错误:

System.Reflection.TargetInvocationException:调用目标抛出了异常.---> System.TypeLoadException:无法从程序集"Microsoft.WindowsAzure.Storage,Version = 4.3.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35"加载类型"Microsoft.WindowsAzure.Storage.Blob.CloudAppendBlob".at MyDotNetActivity.SampleActivity.Execute(IEnumerable 1 linkedServices, IEnumerable1数据集,活动活动,IActivityLogger记录器),位于Microsoft.Azure.Management.DataFactories.Runtime.ActivityExecutor.Execute(对象作业,字符串配置,Action`1 logAction)---内部异常结束堆栈跟踪---在System.RevlectionMethodHandle.InvokeMethod(Object target,Object []参数,Signature sig,布尔构造函数)处于System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj,Object [] parameters,Object [] arguments)at System .Reflection.RuntimeMethodInfo.Invoke(Object obj,BindingFlags invokeAttr,Binder binder,Object []参数,CultureInfo文化)在f:_Bld\12752\4106\Sources\Product中的Microsoft.DataPipeline.Compute.HDInsightJobExecution.ReflectingActivityWrapper.Execute()\Common\Compute\src\HDIComputeDelegatorJob\ReflectingActivityWrapper.cs:第44行,位于f:_Bld\12752\4106\Sources\Product\Common\Compute\src\HDIComput中的Microsoft.DataPipeline.Compute.HDInsightJobExecution.JobWrapper.RunJob()eDelegatorJob\JobWrapper.cs:f:_Bld\12752\4106\Sources\Product\Common\Compute\src\HDIComputeDelegatorJob\Launcher.cs中Microsoft.DataPipeline.Compute.HDInsightJobExecution.Launcher.Main(String [] args)的第94行:第78行.

azure azure-storage custom-activity

6
推荐指数
1
解决办法
1578
查看次数

HttpContext和TelemetryInitializer

我想将用户的"client_id"声明作为属性附加到发送到Application Insights的每个请求.

从我所读到的,我应该实现,ITelemetryInitializer但我需要HttpContext为请求,以检索"client_id".看我的初始化者:

public class ClaimTelemetryInitializer : ITelemetryInitializer
{
    public HttpContext HttpContext { get; set; }

    public void Initialize(ITelemetry telemetry)
    {
        this.AddTelemetryContextPropertFromClaims(telemetry, "client_id");
    }

    private void AddTelemetryContextPropertFromClaims(ITelemetry telemetry, string claimName)
    {
        if (HttpContext != null)
        {
            var requestTelemetry = telemetry as RequestTelemetry;

            var claim = HttpContext.User.Claims.SingleOrDefault(x => x.Type.Equals(claimName, StringComparison.InvariantCultureIgnoreCase));

            if (claim != null)
            {
                telemetry.Context.Properties[claimName] = claim.Value;
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我可以创建一个动作过滤器来每次设置上下文,但这感觉很糟糕:

public class TrackClaimsAttribute : ActionFilterAttribute
{
    public override Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
    { …
Run Code Online (Sandbox Code Playgroud)

azure-application-insights

4
推荐指数
2
解决办法
1815
查看次数

将 CSV 从 Blob 加载到 Azure SQL Server - 未找到引用的外部数据源

我正在尝试将 Blob 存储中托管的 CSV 批量插入到 Azure SQL Server 中,如MSDN 帖子中所述。

我的代码几乎完全取自这个 Microsoft Github 示例

运行它时,我收到以下错误:

找不到引用的外部数据源“MyAzureBlobStorage”。

-- Create Database Master Key
IF (select Count(*) from sys.symmetric_keys where name like '%DatabaseMasterKey%') = 0
BEGIN
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'MYPASSWORD'; 
END

-- Create Storage Credential
IF (select Count(*) from sys.database_credentials where name = 'MyAzureBlobStorageCredential') = 0
BEGIN
print 'Creating credential'
CREATE DATABASE SCOPED CREDENTIAL MyAzureBlobStorageCredential
WITH IDENTITY = 'SHARED ACCESS SIGNATURE',
SECRET = '<secret>';
END …
Run Code Online (Sandbox Code Playgroud)

sql-server csv sqlbulkcopy azure azure-sql-database

4
推荐指数
1
解决办法
4718
查看次数

在 TypeScript 中使用外部 javascript 脚本

假设我有一个 javascript 文件 myScript.js,其中包含以下内容:

function run(file) {
    // some operations
}
Run Code Online (Sandbox Code Playgroud)

如何在 TypeScript 文件中使用“ run ”函数?

我读过类似的问题,但没有发现他们的答案足够清楚:我在哪里声明函数?我如何引用声明文件等..

javascript typescript

3
推荐指数
1
解决办法
1万
查看次数

无法将文件上传到SAS URI

这里我使用的是Microsoft Storage Library,但我无法将文件上传到Azure存储

码:

 public class UploadFile {

public static void uploadFile(String sasURL,String filePath,String submissionGuid) throws MalformedURLException, URISyntaxException
{
    URI sasUrl = new URI(sasURL);

    try
    {
        CloudBlobContainer container = new CloudBlobContainer(sasUrl);
        CloudBlockBlob blob = container.getBlockBlobReference(sasUrl.getPath());
        File source = new File(filePath);
        blob.upload(new FileInputStream(source), source.length());
    }
    catch (Exception e)
    {
        // Output the stack trace.
        e.printStackTrace();
    }


}
}
Run Code Online (Sandbox Code Playgroud)

Sas Uri Generated是:

 https://assetservice.blob.core.windows.net/org66/7594787459-5373-4485-a5ad-8b8a9b5af62c/Input/834793kfhreh-ee2a-4c80-a766-146fc139f2c4.hlkx?sv=2013-08-15&sr=b&sig=jkdhfueiwhdjscnkljshchcvdhcdsnc&se=2016-07-13T18%3A18%3A09Z&sp=w
Run Code Online (Sandbox Code Playgroud)

我收到错误消息:

java.io.IOException
at com.microsoft.azure.storage.core.Utility.initIOException(Utility.java:569)
at com.microsoft.azure.storage.blob.BlobOutputStream.writeBlock(BlobOutputStream.java:444)
at com.microsoft.azure.storage.blob.BlobOutputStream.access$000(BlobOutputStream.java:53)
at com.microsoft.azure.storage.blob.BlobOutputStream$1.call(BlobOutputStream.java:388)
at com.microsoft.azure.storage.blob.BlobOutputStream$1.call(BlobOutputStream.java:385)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at …
Run Code Online (Sandbox Code Playgroud)

java azure azure-storage azure-storage-blobs

2
推荐指数
1
解决办法
716
查看次数

如何使用C#获取其他进程的环境变量

我有一个提升的进程,我正在尝试使用C#从另一个进程中提取环境变量。我知道通过使用Process Explorer,该变量存在。

我可以得到如下的流程环境变量:

Process process = Process.GetProcessesByName("someprocess").First();
string value = process.StartInfo.EnvironmentVariables["var_name"];
Run Code Online (Sandbox Code Playgroud)

但是StartInfo只返回传递给process.Start()的过程环境变量的子集

如何获得在流程运行期间设置了蜜蜂的环境变量?

.net c# environment-variables

2
推荐指数
1
解决办法
3008
查看次数