Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/327.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 缺少DLL';s发布ASP.NET核心web应用程序时_C#_Asp.net_Visual Studio 2015_Asp.net Core Mvc_Asp.net Core 1.0 - Fatal编程技术网

C# 缺少DLL';s发布ASP.NET核心web应用程序时

C# 缺少DLL';s发布ASP.NET核心web应用程序时,c#,asp.net,visual-studio-2015,asp.net-core-mvc,asp.net-core-1.0,C#,Asp.net,Visual Studio 2015,Asp.net Core Mvc,Asp.net Core 1.0,当我发布我的ASP.NET Core(v1.0.0)MVC 6应用程序时,它在查看任何页面时都无法成功运行(即,服务器/主机启动正常,但在发出GET请求时抛出错误)。在命令提示符下启动应用程序时,我可以看到它抱怨缺少DLL。我将丢失的DLL添加到发布的目录(应用程序由IIS/Krestel托管),然后它抱怨另一个DLL,然后是另一个,依此类推。最终,它需要以下DLL才能成功运行: Microsoft.DotNet.Cli.Utils.dll Microsoft.DotNet.ProjectMod

当我发布我的ASP.NET Core(v1.0.0)MVC 6应用程序时,它在查看任何页面时都无法成功运行(即,服务器/主机启动正常,但在发出GET请求时抛出错误)。在命令提示符下启动应用程序时,我可以看到它抱怨缺少DLL。我将丢失的DLL添加到发布的目录(应用程序由IIS/Krestel托管),然后它抱怨另一个DLL,然后是另一个,依此类推。最终,它需要以下DLL才能成功运行:

Microsoft.DotNet.Cli.Utils.dll
Microsoft.DotNet.ProjectModel.dll
Microsoft.Extensions.CommandLineUtils.dll
NuGet.Common.dll
NuGet.Configuration.dll
NuGet.DependencyResolver.Core.dll
NuGet.Frameworks.dll
NuGet.LibraryModel.dll
NuGet.Packaging.Core.dll
NuGet.Packaging.Core.Types.dll
NuGet.Packaging.dll
NuGet.ProjectModel.dll
NuGet.Protocol.Core.Types.dll
NuGet.Protocol.Core.v3.dll
NuGet.Repositories.dll
NuGet.RuntimeModel.dll
NuGet.Versioning.dll
我不知道为什么发布的web应用程序需要NuGet DLL,或者为什么会发生这种情况。显然,VisualStudio应该为我们处理这类事情。现在,当我发布时,我没有先清除所有文件(因此我手动复制的DLL保留在那里),但我想知道,如果需要这些DLL,为什么它们不作为部署过程的一部分包括在内

以下是我的project.json,以防有帮助:

{
  "dependencies": {
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.0",
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "Microsoft.AspNetCore.Session": "1.0.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Serilog.Extensions.Logging": "1.2.0",
    "Serilog.Sinks.File": "2.2.0",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
    "System.Data.Common": "4.1.0",
    "System.Data.SqlClient": "4.1.0",
    "System.DirectoryServices.Linq": "1.2.2.1",
    "Microsoft.Extensions.Logging.Filter": "1.0.0",
    "BundlerMinifier.Core": "2.2.281"
  },

  "tools": {
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },

  "frameworks": {
    "net462": {}
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "Views",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  },

  "configurations": {
    "DEV": {
      "compilationOptions": { "define": [ "DEV" ] },
      "buildOptions": { "define": [ "DEV" ] }
    },
    "PROD_SRV": {
      "compilationOptions": { "define": [ "TEST_SRV" ] },
      "buildOptions": { "define": [ "TEST_SRV" ] }
    },
    "PROD_SRV_DEV": {
      "compilationOptions": { "define": [ "TEST_SRV_DEV" ] },
      "buildOptions": { "define": [ "TEST_SRV_DEV" ] }
    },
    "TEST": {
      "compilationOptions": { "define": [ "TEST" ] },
      "buildOptions": { "define": [ "TEST" ] }
    },
    "TEST_SRV": {
      "compilationOptions": { "define": [ "TEST_SRV" ] },
      "buildOptions": { "define": [ "TEST_SRV" ] }
    },
    "TEST_SRV_DEV": {
      "compilationOptions": { "define": [ "TEST_SRV_DEV" ] },
      "buildOptions": { "define": [ "TEST_SRV_DEV" ] }
    }
  }
}
有什么想法吗


谢谢各位

嗯,我解决了这个问题。我创建了一个新的ASP.NET核心(.NET Framework)web应用程序项目,并且能够毫无问题地发布。因此,我将project.json/global.json文件中的值与项目中的版本进行了比较。我在project.json中将所有版本更新为最新版本,但这并没有解决问题。但在将global.json中的键“sdk:version”更新为“1.0.0-preview2-003131”之后,它就成功了。我不敢相信这是个问题,但它起了作用

在经历了大量的头痛之后,我也能够让WebDeploy正常工作。太多的努力只是为了发表