使用参考组件时出现U-SQL错误 [英] U-SQL Error while using REFERENCE ASSEMBLY

查看:61
本文介绍了使用参考组件时出现U-SQL错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Azure API创建了一个U-SQL库,并在具有所有依赖项的Azure云上注册了程序集.我在U-SQL项目中添加了该库,并在U-SQL脚本中的

I created a U-SQL library using Azure APIs and register the assembly on Azure cloud with all dependencies. I added this library with my U-SQL project and added below line On my U-SQL script

USE master;
REFERENCE ASSEMBLY [AzureLibrary];

在使用我在库中创建的函数或方法时,出现以下错误消息.

At the time of using functions or methods I created in library, I got below error message.

用户表达式的内部异常:无法加载文件或程序集'Microsoft.Azure.Management.DataLake.Store,版本= 1.0.0.0,文化=中性,PublicKeyToken = 31bf3856ad364e35'或其中之一依赖关系.该系统找不到指定的文件.当前行转储:结果:"zzz"

Inner exception from user expression: Could not load file or assembly 'Microsoft.Azure.Management.DataLake.Store, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. Current row dump: result: "zzz"

请帮助,我尝试了几种方法,但是每次都会出现相同的消息.

Please help, I tried several ways but the same message appears every time.

====================================

======================================

我正在使用以下代码

public static int DelTest()
        {
            int Retval = 1;
            try
            {
                var secretKey = <secret key>;
                var appId = <app id>;
                var tenantId = <tenant id>;
                string _adlsAccountName = <adls account name>;
                DataLakeStoreFileSystemManagementClient _adlsFileSystemClient;

                var context = new AuthenticationContext("https://login.windows.net/" + tenantId);
                ClientCredential clientCredential = new ClientCredential(appId, secretKey);
                var tokenResponse = context.AcquireTokenAsync("https://management.azure.com/", clientCredential).Result;
                var accessToken = tokenResponse.AccessToken;
                using (var client = new HttpClient())
                {
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer " + accessToken);
                    client.BaseAddress = new Uri("https://management.azure.com/");
                    // Now we can party with our HttpClient!
                }

                ServiceClientCredentials creds = new TokenCredentials(tokenResponse.AccessToken);

                _adlsFileSystemClient = new DataLakeStoreFileSystemManagementClient(creds);
                DataLakeStoreAccountManagementClient _adlsClient = new DataLakeStoreAccountManagementClient(creds);
                _adlsFileSystemClient.FileSystem.Delete(_adlsAccountName, "/raw_files/sls_tty_typ.txt");
            }
            catch (Exception)
            {
                Retval = 0;
                throw;
            }
            return Retval;
        }

我使用注册程序集"进行注册

I register it using "Register Assembly"

我在U-SQL脚本中使用了以下代码

I used below code in U-SQL script

USE [master];
REFERENCE ASSEMBLY [USQLCSharpProject1];

@ext =
    EXTRACT result string
    FROM "/raw_files/test_file.txt"
    USING Extractors.Csv();

@ext1 =
    SELECT result,
           USQLCSharpProject1.Class1.DelTest() AS del_success FROM @ext;

OUTPUT @ext1
TO "/raw_files/test_file1.txt"
USING Outputters.Csv();

在执行过程中,我收到以下错误消息.

During execution, I got below error message.

请找到 packages.config 文件

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Microsoft.Azure.Management.DataLake.Analytics" version="1.0.1-preview" targetFramework="net452" />
  <package id="Microsoft.Azure.Management.DataLake.Store" version="1.0.2-preview" targetFramework="net452" />
  <package id="Microsoft.Azure.Management.DataLake.StoreUploader" version="1.0.0-preview" targetFramework="net452" />
  <package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="3.13.8" targetFramework="net452" />
  <package id="Microsoft.Rest.ClientRuntime" version="2.3.2" targetFramework="net452" />
  <package id="Microsoft.Rest.ClientRuntime.Azure" version="3.3.2" targetFramework="net452" />
  <package id="Newtonsoft.Json" version="6.0.8" targetFramework="net452" />
</packages>

推荐答案

对于此问题,请检查以下情况:

For this issue, Please check below scenarios:

1)确保程序集的复制本地"属性为true:

1) Make sure the assembly's property Copy Local is true:

2)在进行寄存器组装时,请确保选择了托管依赖项":

2) When Register Assembly, please make sure the Managed Dependencies are selected:

3)请检查bin/Debug文件夹以确保该程序集存在.如果寄存器大于15kb,请确保它在Data Lake存储中存在

3) please check bin/Debug folder to make sure this assembly is existed. If the register assembies larger than 15kb, please make sure it is existed in Data Lake store

这篇关于使用参考组件时出现U-SQL错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆