本文介绍了尝试在Linux上运行Netcore应用程序时出现无效的runtimeconfig.json错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了.net核心控制台应用程序.它与Azure表存储连接,并从azure下载到本地数据库.Windows 10 PC上的应用程序没有任何问题.但是,当我将其发布到运行Lubuntu的PC并尝试运行时,会收到无效的runtimeconfig.json错误".

I have developed .net core console application. It connects with Azure table storage and downloads from azure to a local database. Application is working w/o any issues on a Windows 10 PC. However when I publish it to a PC running Lubuntu and try to run I receive "Invalid runtimeconfig.json error".

runtimeconfig.json的内容是:

Content of runtimeconfig.json is:

{
  "runtimeOptions": {
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "1.1.2"
    }
  }
}

dotnet --info的输出为:

and output of dotnet --info is:

NET Command Line Tools (1.0.4)
Product Information:
Version: 1.0.4
Commit SHA-1 hash: af1e6684fd
Runtime Environment:
OS Name: ubuntu
OS Version: 17.04
OS Platform: Linux
RID: ubuntu.16.10-x64
Base Path: /usr/share/dotnet/sdk/1.0.4

用于Linux的SDK是最新版本.任何人都知道什么地方可能出问题以及如何解决?

SDK for Linux is the latest version. Anybody have any ideas what might be wrong and how to fix it?

推荐答案

经过反复试验,我已经解决了该问题.问题实际上不是无效的配置文件.当dotnet运行dll文件时,它将创建一个xxxx.runtimeconfig.dev.json,其中xxxx是dll的名称.但是,在我的情况下,由于缺少Lubuntu中的文件夹和文件访问权限,dotnet无法创建runtimeconfig.dev.json文件.

After some trial and error I have resolved the issue. Problem is not really a invalid configuration file. When dotnet runs the dll file it creates a xxxx.runtimeconfig.dev.json, xxxx being the name of dll. However in my case due to missing folder and file access rights in Lubuntu, dotnet was not able to create the runtimeconfig.dev.json file.

我已通过执行以下终端命令(从folderholdingmyapp的父目录运行)来修改对保存我的应用程序的文件夹的访问权限

I have modified access rights to folder holding my application by executing following terminal command (run this from parent directory of folderholdingmyapp)

chmod -R 1744 folderholdingmyapp

这篇关于尝试在Linux上运行Netcore应用程序时出现无效的runtimeconfig.json错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 17:18