I have a small Asp.Net Core web app. I targeted the net461 framework because it has a dependency on Restsharp.
When I run this web app as ./web.exe, it returns with HTTP 500. When I run with "dotnet run" from project folder, it runs fine.
I must use the first version because I publish that to a provider who doesn't have .Net SDK.
What can i do?
My project.json
is here:
{
"dependencies": {
//"Microsoft.NETCore.App": {
// "version": "1.0.0",
// "type": "platform"
// },
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"RestSharp": "105.2.3",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.Extensions.Logging.Debug": "1.0.0"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview2-final",
"imports": [
"portable-net45+win8","net451"
]
}
},
"frameworks": {
"net461": {}
//"netcoreapp1.0": {
// "imports": [
// "dotnet5.6",
// "portable-net45+win8"
// ]
//}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimes": {
"win81-x64": {}
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
Finally, I solved the problem. I missed something from WebhostBuilder.
With
.UseIISIntegration()
it works fine.