Giter Club home page Giter Club logo

dotnet-core-api's Introduction

languages page_type description products
csharp
aspx-csharp
sample
This is a sample application that you can use to follow along with the Run a RESTful API with CORS in Azure App Service tutorial.
azure
aspnet-core
azure-app-service

ASP.NET Core API sample for Azure App Service

This is a sample application that you can use to follow along with the tutorial at Run a RESTful API with CORS in Azure App Service.

License

See LICENSE.

Contributing

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

dotnet-core-api's People

Contributors

cephalin avatar microsoftopensource avatar msftgits avatar supernova-eng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dotnet-core-api's Issues

Can you just update this sample for dotnet 3.1?

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Any log messages given by the failure

Expected/desired behavior

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

NuGet.targets error: Access to path '/var/nuget/system.net.nameresolutionh.4.3.0' is denied

This issue is for a: (mark with an x)

- [X ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

On an Ubuntu 18.10 system on which mono, dotnetcore sdk, have been installed, follow the procedure in your document:

https://docs.microsoft.com/en-us/azure/app-service/containers/tutorial-auth-aad

The errors happen after entering: git push backend master

root@ububox:/git/learning/dotnet-core-api/mike2/dotnet-core-api# git remote add backend "https://[email protected]/adotnetcore-api.git"
root@ububox:
/git/learning/dotnet-core-api/mike2/dotnet-core-api# git push backend master
Enumerating objects: 65, done.
Counting objects: 100% (65/65), done.
Delta compression using up to 8 threads
Compressing objects: 100% (62/62), done.
Writing objects: 100% (65/65), 17.79 KiB | 4.45 MiB/s, done.
Total 65 (delta 19), reused 0 (delta 0)
remote: Deploy Async
remote: Updating branch 'master'.
remote: Updating submodules.
remote: Preparing deployment for commit id '80172f47da'.
remote: Generating deployment script.
remote: Project file path: ./TodoApi.csproj
remote: Generated deployment script files
remote: Running deployment command...
remote: Handling ASP.NET Core Web Application deployment.
remote: ...
remote: Restoring packages for /home/site/repository/TodoApi.csproj...
remote: .........
remote: Installing System.Collections.Immutable 1.3.0.
.
.
.
remote: Installing Microsoft.DotNet.InternalAbstractions 1.0.0.
remote: /opt/dotnet/2.2.104/sdk/2.2.104/NuGet.targets(114,5): error : Access to the path '/var/nuget/system.net.nameresolution/4.3.0' is denied. [/home/site/repository/TodoApi.csproj]
remote: /opt/dotnet/2.2.104/sdk/2.2.104/NuGet.targets(114,5): error : Permission denied [/home/site/repository/TodoApi.csproj]
remote: An error has occurred during web site deployment.
remote: dotnet restore failed
remote: App container will begin restart within 10 seconds.

remote: Deployment Logs : 'https://adotnetcore-api.scm.azurewebsites.net/newui/jsonviewer?view_url=/api/deployments/80172f47da2014d399da68a8bf5e3d4c8260b712/log'
To https://adotnetcore-api.scm.azurewebsites.net/adotnetcore-api.git

  • [new branch] master -> master

I have tried to work-around this issue by manually creating the folders, running as root, but to no avail.

Any log messages given by the failure

remote: /opt/dotnet/2.2.104/sdk/2.2.104/NuGet.targets(114,5): error : Access to the path '/var/nuget/system.net.nameresolution/4.3.0' is denied. [/home/site/repository/TodoApi.csproj]
remote: /opt/dotnet/2.2.104/sdk/2.2.104/NuGet.targets(114,5): error : Permission denied [/home/site/repository/TodoApi.csproj]
remote: An error has occurred during web site deployment.
remote: dotnet restore failed
remote: App container will begin restart within 10 seconds.

Expected/desired behavior

Success

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)
Ubuntu 18.10

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Web site deployment error

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Web site deployment error at git push frontend master in Azure at Call API securely from server code and Call API securely from browser code steps for files modifications.

Any log messages given by the failure

Using shared compilation with compiler from directory: D:\Program Files (x86)\MSBuild-16.4\MSBuild\Current\Bin\Roslyn
Controllers\TodoController.cs(23,10): error CS1513: } expected [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(32,22): error CS1519: Invalid token '=' in class, struct, or interface member declaration [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(32,31): error CS1519: Invalid token ';' in class, struct, or interface member declaration [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(34,41): error CS8124: Tuple must contain at least two elements. [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(34,41): error CS1026: ) expected [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(34,42): error CS8124: Tuple must contain at least two elements. [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(34,44): error CS1519: Invalid token '==' in class, struct, or interface member declaration [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(36,39): error CS1519: Invalid token '(' in class, struct, or interface member declaration [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(36,40): error CS1031: Type expected [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(36,40): error CS8124: Tuple must contain at least two elements. [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(36,40): error CS1026: ) expected [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(36,53): error CS1519: Invalid token '{' in class, struct, or interface member declaration [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(36,60): error CS1519: Invalid token '=' in class, struct, or interface member declaration [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(36,71): error CS1022: Type or namespace definition, or end-of-file expected [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(37,26): error CS0116: A namespace cannot directly contain members such as fields or methods [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(37,38): error CS8124: Tuple must contain at least two elements. [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(37,39): error CS1022: Type or namespace definition, or end-of-file expected [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(39,9): error CS1022: Type or namespace definition, or end-of-file expected [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(90,5): error CS1022: Type or namespace definition, or end-of-file expected [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(91,1): error CS1022: Type or namespace definition, or end-of-file expected [D:\home\site\repository\TodoApi.csproj]
Done Building Project "D:\home\site\repository\TodoApi.csproj" (default targets) -- FAILED.

Build FAILED.

"D:\home\site\repository\TodoApi.csproj" (default target) (1:7) ->
(CoreCompile target) ->
Controllers\TodoController.cs(23,10): error CS1513: } expected [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(32,22): error CS1519: Invalid token '=' in class, struct, or interface member declaration [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(32,31): error CS1519: Invalid token ';' in class, struct, or interface member declaration [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(34,41): error CS8124: Tuple must contain at least two elements. [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(34,41): error CS1026: ) expected [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(34,42): error CS8124: Tuple must contain at least two elements. [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(34,44): error CS1519: Invalid token '==' in class, struct, or interface member declaration [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(36,39): error CS1519: Invalid token '(' in class, struct, or interface member declaration [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(36,40): error CS1031: Type expected [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(36,40): error CS8124: Tuple must contain at least two elements. [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(36,40): error CS1026: ) expected [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(36,53): error CS1519: Invalid token '{' in class, struct, or interface member declaration [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(36,60): error CS1519: Invalid token '=' in class, struct, or interface member declaration [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(36,71): error CS1022: Type or namespace definition, or end-of-file expected [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(37,26): error CS0116: A namespace cannot directly contain members such as fields or methods [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(37,38): error CS8124: Tuple must contain at least two elements. [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(37,39): error CS1022: Type or namespace definition, or end-of-file expected [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(39,9): error CS1022: Type or namespace definition, or end-of-file expected [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(90,5): error CS1022: Type or namespace definition, or end-of-file expected [D:\home\site\repository\TodoApi.csproj]
Controllers\TodoController.cs(91,1): error CS1022: Type or namespace definition, or end-of-file expected [D:\home\site\repository\TodoApi.csproj]

0 Warning(s)
20 Error(s)

Time Elapsed 00:00:10.89
Failed exitCode=1, command="D:\Program Files (x86)\MSBuild-16.4\MSBuild\Current\Bin\MSBuild.exe" /restore "D:\home\site\repository\TodoApi.csproj" /p:DeployOnBuild=true /p:configuration=Release /p:publishurl="D:\local\Temp\8d8535a52d249ba"
An error has occurred during web site deployment.
\r\nD:\Program Files (x86)\SiteExtensions\Kudu\89.20818.4754\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"

Expected/desired behavior

Unable to deploy to the website, only commited to remote repository.

OS and Version?

Windows 10

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Unable to run on macOS when .net core 3.0 is installed

I'm getting an error when trying to run this on macOS. I have .net core 3.0 installed, not sure if that is causing this or not. If so, you should be able to solve with a global.json file.

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

  1. Clone sample
  2. dotnet build
  3. dotnet run

OS and Version?

macOS Mojave 10.14.5

Error message on dotnet run

PS /Users/sayedhashimi/data/mycode/OSS/dotnet-core-api> dotnet build
Microsoft (R) Build Engine version 16.3.0-preview-19377-01+dd8019d9e for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 570.63 ms for /Users/sayedhashimi/data/mycode/OSS/dotnet-core-api/TodoApi.csproj.
  Restore completed in 859.64 ms for /Users/sayedhashimi/data/mycode/OSS/dotnet-core-api/TodoApi.csproj.
  You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
  TodoApi -> /Users/sayedhashimi/data/mycode/OSS/dotnet-core-api/bin/Debug/netcoreapp2.0/TodoApi.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:05.73
PS /Users/sayedhashimi/data/mycode/OSS/dotnet-core-api> dotnet run

Unhandled Exception: System.InvalidOperationException: HTTPS endpoints can only be configured using KestrelServerOptions.Listen().
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.<BindAddressAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.<BindAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.<BindAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.<StartAsync>d__21`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.<StartAsync>d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.<RunAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.<RunAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
   at TodoApi.Program.Main(String[] args) in /Users/sayedhashimi/data/mycode/OSS/dotnet-core-api/Program.cs:line 18

dotnet info

PS /Users/sayedhashimi/data/mycode/OSS/dotnet-core-api> dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.0.100-preview8-013656
 Commit:    8bf06ffc8d

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.14
 OS Platform: Darwin
 RID:         osx.10.14-x64
 Base Path:   /usr/local/share/dotnet/sdk/3.0.100-preview8-013656/

Host (useful for support):
  Version: 3.0.0-preview8-28405-07
  Commit:  d01b2fb7bc

.NET Core SDKs installed:
  1.1.14 [/usr/local/share/dotnet/sdk]
  2.1.2 [/usr/local/share/dotnet/sdk]
  2.1.400 [/usr/local/share/dotnet/sdk]
  2.1.700 [/usr/local/share/dotnet/sdk]
  2.2.300 [/usr/local/share/dotnet/sdk]
  3.0.100-preview8-013656 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0-preview8.19405.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 1.0.16 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.1.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.11 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-preview8-28405-07 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

App/Views/TodoList.html 404 (Not Found)

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

git clone https://github.com/Azure-Samples/dotnet-core-api.git
cd dotnet-core-api
dotnet run

Any log messages given by the failure

GET http://localhost:5000/App/Views/TodoList.html 404 (Not Found)

Expected/desired behavior

Run without console error

OS and Version?

Linux Ubuntu 16.04

Mention any other details that might be useful

Uppercase in wwwroot/app/scripts/app.js, line number 13

Handle Dynamic Connection Strings

We need to handle dynamic connection strings. The idea is that different clients of our Web API need to have different databases. We want that when client A makes a request to the Web API, database X is used; & when a client B does the same, then database Z is used

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.