草庐IT

core_cmInstr

全部标签

怎么启动.net core 项目

要启动.NETCore项目,你需要先确保你的电脑上已经安装了.NETCore运行时。如果你还没有安装,请前往https://dotnet.microsoft.com/download下载并安装。然后,你可以使用以下方法来启动你的.NETCore项目:在命令行中进入你的项目文件夹,然后输入以下命令:dotnetrun在VisualStudio中打开你的项目,然后点击“运行”按钮。在VisualStudioCode中打开你的项目,然后按下F5键。注意,你需要在项目文件夹中打开命令行或使用VisualStudio或VisualStudioCode来启动项目。如果你在启动项目时遇到问题,请检查你的项目

c# - IIS 错误 502.5 上的 ASP.NET Core 1.0

我刚刚将我的服务器(Windows2012R2)从以前的.NetCore1.0RC2更新到.NetCore1.0RTMWindows主机包。我的应用程序在我的PC上运行没有任何问题,但服务器一直显示:HTTPError502.5-ProcessFailureCommoncausesofthisissue:TheapplicationprocessfailedtostartTheapplicationprocessstartedbutthenstoppedTheapplicationprocessstartedbutfailedtolistenontheconfiguredport它以前

c# - IIS 错误 502.5 上的 ASP.NET Core 1.0

我刚刚将我的服务器(Windows2012R2)从以前的.NetCore1.0RC2更新到.NetCore1.0RTMWindows主机包。我的应用程序在我的PC上运行没有任何问题,但服务器一直显示:HTTPError502.5-ProcessFailureCommoncausesofthisissue:TheapplicationprocessfailedtostartTheapplicationprocessstartedbutthenstoppedTheapplicationprocessstartedbutfailedtolistenontheconfiguredport它以前

c# - ASP.NET Core 使用 IConfiguration 获取 Json 数组

在appsettings.json中{"MyArray":["str1","str2","str3"]}在Startup.cs中publicvoidConfigureServices(IServiceCollectionservices){services.AddSingleton(Configuration);}在家庭Controller中publicclassHomeController:Controller{privatereadonlyIConfiguration_config;publicHomeController(IConfigurationconfig){this._c

c# - ASP.NET Core 使用 IConfiguration 获取 Json 数组

在appsettings.json中{"MyArray":["str1","str2","str3"]}在Startup.cs中publicvoidConfigureServices(IServiceCollectionservices){services.AddSingleton(Configuration);}在家庭Controller中publicclassHomeController:Controller{privatereadonlyIConfiguration_config;publicHomeController(IConfigurationconfig){this._c

c# - ASP.NET Core 表单 POST 导致 HTTP 415 Unsupported Media Type 响应

将表单POSTHTTP请求(Content-Type:application/x-www-form-urlencoded)发送到下面的Controller会导致HTTP415UnsupportedMediaType响应。publicclassMyController:Controller{[HttpPost]publicasyncTaskSubmit([FromBody]MyModelmodel){//...}}表单发布HTTPheader:POST/submitHTTP/1.1Host:example.com:1337Connection:keep-aliveContent-Leng

c# - ASP.NET Core 表单 POST 导致 HTTP 415 Unsupported Media Type 响应

将表单POSTHTTP请求(Content-Type:application/x-www-form-urlencoded)发送到下面的Controller会导致HTTP415UnsupportedMediaType响应。publicclassMyController:Controller{[HttpPost]publicasyncTaskSubmit([FromBody]MyModelmodel){//...}}表单发布HTTPheader:POST/submitHTTP/1.1Host:example.com:1337Connection:keep-aliveContent-Leng

c# - 如何在 ASP.NET Core 中启用 CORS

我正尝试在我的ASP.NETCoreWebAPI上启用跨源资源共享,但我卡住了。EnableCors属性接受string类型的policyName作为参数://Summary://CreatesanewinstanceoftheMicrosoft.AspNetCore.Cors.Core.EnableCorsAttribute.////Parameters://policyName://Thenameofthepolicytobeapplied.publicEnableCorsAttribute(stringpolicyName);policyName是什么意思,如何在ASP.NETC

c# - 如何在 ASP.NET Core 中启用 CORS

我正尝试在我的ASP.NETCoreWebAPI上启用跨源资源共享,但我卡住了。EnableCors属性接受string类型的policyName作为参数://Summary://CreatesanewinstanceoftheMicrosoft.AspNetCore.Cors.Core.EnableCorsAttribute.////Parameters://policyName://Thenameofthepolicytobeapplied.publicEnableCorsAttribute(stringpolicyName);policyName是什么意思,如何在ASP.NETC

c# - 如何从 ASP.NET Core RC2 Web Api 返回 HTTP 500?

回到RC1,我会这样做:[HttpPost]publicIActionResultPost([FromBody]stringsomething){try{//...}catch(Exceptione){returnnewHttpStatusCodeResult((int)HttpStatusCode.InternalServerError);}}在RC2中,不再有HttpStatusCodeResult,而且我找不到任何可以让我返回500类型的IActionResult的东西。对于我要问的问题,现在的方法是否完全不同?我们不再在Controller代码中trycatch了吗?我们是否只