gpt4 book ai didi

entity-framework-6 - 在 asp.net-core mvc 应用程序中创建新的 ApiController 时发生 PathTooLongException

转载 作者:行者123 更新时间:2023-12-03 23:41:17 25 4
gpt4 key购买 nike

我使用带有 .NET 4.6.1 的 ASP.NET Web 应用程序完整框架模板创建了一个 ASP.NET MVC 项目

我尝试使用带有 Entity Framework 的脚手架项目创建 Api Controller 。在创建期间它失败并显示错误消息 -

"Unhandled Exception: System.IO.PathTooLongException." while executing codegenerator.exe.

enter image description here

我的项目是这样的-

D:\Perforce\XYZ\ABC\POC\ABC_PROEJCT\src\ABC_PROEJCT\Controllers

这就是我的 project.json 的样子-

{
"dependencies": {
"Glimpse": "2.0.0-beta1",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Identity": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.0",
"Microsoft.AspNetCore.Mvc.WebApiCompatShim": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",
"Microsoft.EntityFrameworkCore.SqlServer.Design": {
"version": "1.0.0",
"type": "build"
},
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.Extensions.Configuration.CommandLine": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": "1.0.0-preview2-final",
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": "1.0.0-preview2-final"
},

"tools": {
"BundlerMinifier.Core": "2.0.238",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
"Microsoft.Extensions.SecretManager.Tools": "1.0.0-preview2-final",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview2-final",
"imports": [
"portable-net45+win8"
]
}
},

"frameworks": {
"net461": { }
},

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

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

"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}

我的环境是-

Visual Studio 2015 更新 3

.NET 框架 4.6.1

带有预览版 2 工具集的 .NET 核心 SDK 1.0

Windows 7 64 位操作系统

您能否提供一些意见来解决这个问题?

9 月 20 日更新

我在 VS2015 的 Output 选项卡上看到,在使用脚手架创建 API Controller 时执行以下命令:

C:\Program Files\dotnet\dotnet.exe aspnet-codegenerator --project "D:\Perforce\###\#######\POC\################\src\################" controller --force --controllerName UserTypesTestController --model ################.Models.UserTypes --dataContext ################.Models.#####UserContext --relativeFolderPath Controllers --controllerNamespace ################.Controllers --restWithNoViews.

完整路径连同 Controller 名称不超过 260 个字符。

最佳答案

关于entity-framework-6 - 在 asp.net-core mvc 应用程序中创建新的 ApiController 时发生 PathTooLongException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39574016/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com