My question is simple, since next.js is fast becoming the default react template for most projects and it can be used for either client only or server side development, has anyone tried using next.js project instead of CRA with asp.net core webapi in the template that VS2019 comes with? I just tried only to be treated with some errors about the cra server not responding in a timely manner listing Timespans in the exception details etc.
So just to be clear, I want to know has anyone tried using asp.net core and next.js in a mono-project setup kinda like they have the create react app (CRA) and asp.net core and IdentityServer setup.
If yes, any links would be awesome or any kinda tips implementing this would be awesome.
Thanks
Related
I'm new to ASP.Net and I have the following scenario:
I have a .Net Framework project folder with several projects. All of them are configured .Net Framework 4.7.2 and I have a dependency I can not change at the moment. So migrating to .Net Core is not an option at the moment.
My question is the following:
What is the correct approach to add the functionality of a RESTful server with ASP.Net?
I don't want to implement a frontend. I just want to add a server to my projects.
In
https://learn.microsoft.com/en-us/dotnet/standard/choosing-core-framework-server
it says, "In most cases, you don't need to migrate your existing applications to .NET 5. Instead, a recommended approach is to use .NET 5 as you extend an existing application, such as writing a new web service in ASP.NET Core."
How should I do that?
I'm really confused. Please help me.
Maybe some hints or links to other pages are enough to lead me into the right direction :)
Kind regards
Chris
It basically depends on your future preference and time, If the organisation is pretty much aligned with .netcore what you can do is you can easily migrate .net framework project to .Net standard and create a new .Net core project with API endpoints defined and you can easily refer the .Net standard libraries directly to it.
https://learn.microsoft.com/en-us/dotnet/core/porting/
But if you want to stick to .Net framework libraries, you can create basic Asp.Net core web API with DotNetframework, It is not a legacy framework, it has the latest release within 3 months and it is also battle-tested, But you can only host in windows machines unlike .Net core which you can host in windows/linux
https://developer.okta.com/blog/2018/07/27/build-crud-app-in-aspnet-framework-webapi-and-angular
any .net project that running on a web server supports REST calls. In fact if you make a webmethod?
Say this code:
<WebMethod()>
Public Function HelloWorld() As String
If keyid <> 123 Then Exit Function
Return "Hello World from server"
End Function
Then right out of the box with ONLY the above code?
The above supports SOAP 1.1, 1.2, and post (REST) calls.
So there is no "concept" in asp.net that you "adopt" SOME kind of RESTful server - the server you use in this case is IIS, and it supports REST calls out of the box, and always did from day one to my knowledge. You MOST certainly have to run a web server, but making REST calls does not require a "special" RESTful server, but just in fact that you running a web server - in this case IIS or so called internet services.
If you already have a project that supports and API just add an additional controller, assuming the functionality is not closely related to existing functionality.
I have a ASP.NET Core 2 Web API with the Angular 4 front end SPA application. It was created using clean Core 2 Web API template in VS2017 and angular-cli for the front-end using VSCode. Currently I can successfully run my prototype using either IIS Express WebAPI or self-hosted. I can successfully deploy to IIS using steps simmilar to these: https://learn.microsoft.com/en-us/aspnet/core/publishing/iis?tabs=aspnetcore2x. However, I can't figure out how to attach to the IIS process to be able to step through the code as I used to do with regular old Web API or MVC app hosted in IIS.
I'm coming from traditional Web API and Angular1 environment. Both ends were deployed to IIS and it was a simple process to attach to IIS for troubleshooting. So, maybe it's a stupid question, but I can't seem to find good resource on how to approach production deployment of such Core 2 WebAPI + Angular 2 SPA app. What are the best practices? IIS for Web API and npm for client? Can someone maybe point me to tutorial on how to do that and how to debug/troubleshoot with IIS? Are there a better ways to deploy/host it, maybe my approach is wrong and IIS not needed?
If any pictures, code, setup is needed I'll gladly add it to the question. I just don't know what I can provide at the moment. Any help, advise, link will be much appreciated!
Not 100% sure if this is what you're after, but check out this blog-post:
https://blogs.msdn.microsoft.com/webdev/2017/07/13/development-time-iis-support-for-asp-net-core-applications/
Note: Make sure you select the new launch profile ("IIS") in the main window, before starting a debug session!
following my previous post about my game server, I've decided that I want to create a web-based server, and not a WPF one.
Currently, the server is a console application. I run the server, it has a TcpListener, and I interact with TcpClients, and the only real console-y thing I have, is a bunch of Console.WriteLines that I intend to get rid of. The server itself is part of a class library, which contains all the server logic, so that it'll be easy to wrap it in whatever platform I need.
Say I have a library with all my server-side logic, and I want the GUI of the server to be a web client, while still having a server that runs in the background and keeps the game running - How do I do that with ASP.NET?
Since all my code is C#, it's natural that I would pick ASP.NET, and use MVC with Razor, allowing me to use my original classes as data in the website.
I can handle the website part of the ASP.NET, but what I need advice with is how I create a server that acts like my previous one (runs in the background, has some sort of GUI, for input, commands and etc), and also has a website as the GUI.
Thanks in advance!
for reference, all my ConsoleApplication code is here, showing just how little the platform that runs the server has to do.
And regardless, this is the link to my game code, if anyone is interested. I'm always interested in opinions and constructive criticism!
This is an article about self hosting webapi and static files in a console application using Owin, no support for MVC. Asp.Net Core has a similar work flow (though it's not called Owin anymore), and MVC is available. Asp.Net Core apps are actually self hosted in a console application using Kestrel. When you host asp.net core in IIS all IIS does is act as a proxy.
I am looking at implementing Breeze into one of my web projects. Currently, the client has set up their project to run under MVC4 and Web.API v.1 with an Entity Framework 6 backend.
Looking at the Breeze web site, the instructions talk about running with Web.API v.1 and EF 4 or 5, or using Web.API v.2 and EF 6, but not my scenario.
Is it possible to run in this config or do I HAVE to run Web.API v.2 to get things to work correctly?
Sorry but we have made no effort to make that particular combination work and are unlikely to try. The possible MS technology combinations are endless. We live in DLL hell as it is and we can only support what we perceive to be the main paths.
However, Breeze is all open source and you are welcome to try it yourself. The source code is in the repo. Have at it.
Personally, I would try to persuade your client that moving to Web API v2 is a necessity.
I'm looking at working my long-standing API to run on IIS rather than in a desktop app as it is now. Everything on the API is working so I'd rather not change too much if I don't have to. I know about the new Web API template in ASP.NET MVC 4 and I've worked with it, but I found that it didn't give me the control over everything that this particular project needs.
So my question is, is there any way to build an application for IIS that has something like an entry-point where I can just get a web request then use entirely my own code from there? Or do I have to build something that uses the Web API?
Yes, you'll want an ASP.NET handler.
How To Create an ASP.NET HTTP Handler by Using Visual C# .NET
http://support.microsoft.com/kb/308001
You'll need to handle parsing the request and serializing the result yourself. It's probably much better to create a web-api facade in front of your services than trying to do it manually.