DocumentDB Emulator .Net Core Quickstart Not Loading - azure

I'm following steps here to work with the Azure DocumentDB emulator: https://learn.microsoft.com/en-us/azure/cosmos-db/local-emulator
I have the emulator up and running:
I have downloaded the sample .Net Core app. When I attempt to load it I get the following error:
I'm running:
My project file looks like this:
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Routing": "1.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.StaticFiles": "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",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"Microsoft.Azure.DocumentDB.Core": "*"
},
"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"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
Anyone else have this problem or know how to fix it?

The quickstart sample is xproj project.json so after conversion to csproj/MSBuild it is necessary to modify the csproj file etc. as outlined here:
https://learn.microsoft.com/en-us/dotnet/core/migration/

Related

SignalR Core app deployed to Azure doesn't work over https

I've created a simple web app with SignalR Core and deployed it into Azure, and enabled websockets for app service.
But after that when I try to access it using https:// it returns HTTP ERROR 500.
Any idea what is wrong? Do I need to set anything else in settings to make it work over https?
when I try to access it using https:// it returns HTTP ERROR 500.
Please make sure your SignalR app could run without any error before publishing it to Azure website. I have a sample app that works fine on local and Azure, please refer to it.
Project.json
{
"dependencies": {
"Gray.Microsoft.AspNetCore.SignalR.Server": "0.2.0-alpha1",
"Microsoft.AspNetCore.WebSockets": "1.0.1",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Routing": "1.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.1.1",
"Microsoft.Extensions.Logging.Console": "1.1.1",
"Microsoft.Extensions.Logging.Debug": "1.1.1",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"Microsoft.AspNet.SignalR.Client": "2.2.1"
},
"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"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
Startup class
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
services.AddSignalR(options=> {
options.Hubs.EnableDetailedErrors = true;
});
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseWebSockets();
app.UseSignalR();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
Website Chat page
Besides, this article is about “Getting started with SignalR Core”, please refer to it.

ASP.NET Core 1.1 targeting full framework can not be deployed to Azure App Service

I used the ASP.NETCore 1.0.1 Web App template and attempted to upgrade it ASP.NET Core 1.1.0 using full framework. The app runs fine when run locally, but when I attempt to deploy it to Azure I receive the following (See image below). The project.json changes are included as well below. Are full framework version of 1.1 supported in Azure yet? Is there any workaround to getting this type of app working?
{
"dependencies": {
"Microsoft.AspNetCore.AzureAppServicesIntegration": "1.0.0",
"Microsoft.ApplicationInsights.AspNetCore": "1.0.2",
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.Mvc": "1.1.0",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Routing": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0"
},
"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"
},
"frameworks": {
"net46": {
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
As of 11/28/16 this problem appears to be gone. My assumption is this was Azure issue. This issue was also filed on the ASP.NET Core repo here: ASP.NET Core 1.1 targeting full framework can not be deployed to Azure App Service

Error Deploying .NET Core Application to Azure App Service

I am deploying a .NET core application from GitHub to an Azure App Service and receiving the following error:
Feeds used:
https://api.nuget.org/v3/index.json D:\Program Files (x86)\dotnet\dotnet.exe build "D:\home\site\repository\src\MY_APP"
--configuration Release --no-dependencies --build-base-path "D:\home\site\repository\src\artifacts" Microsoft (R) Build Engine
version 15.1.0.0 Copyright (C) Microsoft Corporation. All rights
reserved. MSBUILD : error MSB1001: Unknown switch.
[D:\home\site\repository\src\MY_APP\MY_APP.xproj] Switch:
--build-base-path
As far as a I can tell, build-base-path is a valid parameter.
This application was deploying fine. In fact, I even tried to redeploy the last good deployment and it too is failing now.
Here is the project.json:
{
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"gcServer": true
},
"userSecretsId": "aspnet-rverbio-457D3F4C-1C63-4A4C-8D65-5EA4FA4EE5F9",
"dependencies": {
"Microsoft.ApplicationInsights.AspNetCore": "1.0.2",
"Microsoft.AspNetCore.Authentication.Cookies": "1.1.0",
"Microsoft.AspNetCore.Authentication.OpenIdConnect": "1.1.0",
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.Mvc": "1.1.0",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.Azure.DocumentDB.Core": "0.1.0-preview",
"Microsoft.Extensions.Configuration.Abstractions": "1.1.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Configuration.UserSecrets": "1.1.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
//"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.13.7",
"Microsoft.IdentityModel.Protocol.Extensions": "2.0.0-beta6-207211625",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0",
"System.IdentityModel.Tokens.Jwt": "5.1.0"
},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.1"
}
},
"imports": "dnxcore50"
}
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.1.0-preview4-final"
},
"Microsoft.Extensions.SecretManager.Tools": {
"version": "1.1.0-preview4-final"
}
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"appsettings.json",
"config.json",
"web.config"
]
},
"scripts": {
"precompile": [
"powershell -f Download-Secrets.ps1"
],
"prepublish": [
"npm install",
"npm run build"
],
"postpublish": [
"dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
]
}
}
Any help would be appreciated.
Update
A colleague of mine created a global.json with the following contents and deployments are working!
{
"sdk": {
"version": "1.0.0-preview2-003131"
}
}

Unable to resolve 'Microsoft.WindowsAzure.Storage (>= 7.2.0)' for '.NETCoreApp,Version=v1.0'

I try to use Windows Azure Storage inside my dotnet core system (my first dotnet core project). I tried the unit test for Azure Storage with dotnet core and it builds well.
But when I try to include the dependency to Azure Storage in my project.json, I receive this message:
Unable to resolve 'Microsoft.WindowsAzure.Storage (>= 7.2.0)' for '.NETCoreApp,Version=v1.0'.
Here is my full project.json file
{
"dependencies": {
"Microsoft.AspNetCore.Mvc": "1.0.*",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.*",
"Microsoft.AspNetCore.Server.IISIntegration":"1.0.*",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.*",
"Microsoft.AspNetCore.Diagnostics": "1.0.*",
"Microsoft.Extensions.Configuration.EnvironmentVariables":"1.0.*",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.*",
"Microsoft.Extensions.Configuration.Json": "1.0.*",
"Microsoft.Extensions.Configuration.CommandLine": "1.0.0",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
"Microsoft.Extensions.Logging":"1.0.*",
"Microsoft.Extensions.Logging.Console": "1.0.*",
"Microsoft.Extensions.Logging.Debug": "1.0.*",
"Microsoft.EntityFrameworkCore": "1.0.*",
"Microsoft.EntityFrameworkCore.Sqlite": "1.0.*",
"Microsoft.EntityFrameworkCore.Design": { "version": "1.0.0-preview2-final", "type": "build" },
"Autofac": "4.0.0-rc3-309",
"Autofac.Extensions.DependencyInjection": "4.0.0-rc3-309",
"FluentValidation": "6.4.0-beta3",
// "Serilog" : "2.0.0",
// "Serilog.Extensions.Logging" : "1.0.0",
// "Serilog.Sinks.Console" : "2.0.0"
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Razor.Tools": { "version": "1.0.0-preview2-final", "type": "build" },
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"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.WindowsAzure.Storage": "7.2.0.0-*"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview2-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"BundlerMinifier.Core": "2.0.238",
"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": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
}
},
"imports": [
// "dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
}
},
"buildOptions": {
"define": [ "NETCORE"],
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"gcServer": true
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"Areas/**/Views",
"appsettings.json",
"web.config"
]
},
"scripts": {
"precompile": [ "dotnet bundle" ],
"prepublish": [ "bower install" ],
"postpublish": [
"dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
]
},
"tooling": {
"defaultNamespace": "Wod6000"
}
}
Do you have an idea on what is wrong?
Our package is named WindowsAzure.Storage. Can you try that instead?

UserSecrets.dll not finding project.json

I'm converting an aspnet5/rc-1 website to the released aspnet core. I'm running into a problem involving user secrets in the development environment.
The call to AddUserSecrets, in the Startup constructor, throws an exception:
public Startup( IHostingEnvironment env )
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.AddJsonFile( "appsettings.json" )
.AddJsonFile( $"appsettings.{env.EnvironmentName}.json", optional: true );
if( env.IsDevelopment() )
{
// this line blows up
builder.AddUserSecrets();
}
builder.AddEnvironmentVariables();
Configuration = builder.Build();
The error message is something to the effect that the project.json file could not be found in the bin/Debug/netcoreapp1.0 folder...which is weird, because I wouldn't expect to find the project.json file in the distributable executable folder in the first place.
This all worked fine under rc1, so something has changed.
Additional Info
Here is the exception detail:
System.InvalidOperationException was unhandled by user code
HResult=-2146233079 Message=Unable to locate a project.json at
'C:\Programming\SpeedView\src\SpeedView\bin\Debug\netcoreapp1.0\'.
Source=Microsoft.Extensions.Configuration.UserSecrets StackTrace:
at Microsoft.Extensions.Configuration.UserSecrets.PathHelper.GetSecretsPath(IFileProvider
provider)
at Microsoft.Extensions.Configuration.ConfigurationExtensions.AddUserSecrets(IConfigurationBuilder
configuration)
at SpeedView.Startup..ctor(IHostingEnvironment env) in C:\Programming\SpeedView\src\SpeedView\Startup.cs:line 48
InnerException:
Here is project.json file:
{
"userSecretsId": "aspnet5-SpeedView-f526a1b2-f58b-4e04-b189-8442609eff8c",
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Microsoft.AspNetCore.Antiforgery": "1.0.0",
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "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.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.EnvironmentVariables": "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.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"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"
},
"AutoMapper": "5.0.2",
"Serilog.Extensions.Logging": "1.1.0",
"Serilog.Sinks.ColoredConsole": "2.0.0",
"Serilog.Sinks.Literate": "2.0.0",
"Serilog.Sinks.RollingFile": "2.2.0",
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-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": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"Areas/**/Views",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "npm install", "bower install", "gulp siteprep" ]
}
}
Don't forget to set your BasePath:
public Startup( IHostingEnvironment env )
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath) // Add this line <-----
.AddJsonFile( "appsettings.json" )
.AddJsonFile( $"appsettings.{env.EnvironmentName}.json", optional: true );

Resources