Microsoft ASP.NET Web API 2 on .net 4.0 - asp.net-web-api

Is it possible to use ASP.NET Web API 2 with .net 4.0? I tried to upgrade from an older version but I get:
Could not install package 'Microsoft.AspNet.WebApi.Client 5.0.0'. You
are trying to install this package into a project that targets
'.NETFramework,Version=v4.0'

To answer my own question:
No, it is NOT possible to use Web API 2 with .net 4.0:
This is taken from a slide by Damian Edwards. You can find additinal info here.

FWIW, I had a .NET 4.0 requirement on the client (die WinXP!), but I could do .NET 4.5 on the server. So, I have WebApi2 running server side, but the WebApi1 client package running on the client, handling serialization, etc.
Using the Package Manager Console in Visual Studio and choosing my client project in the default project dropdown, I was able to:
Install-Package Microsoft.AspNet.WebApi.Client -Version 4.0.30506.0
Everything thereafter worked well.

Related

Connectivity Issue with StackExchange.Redis 1.2.6

I am trying to implement Azure Redis Cache in my existing ASP.NET Web Application.
Its build in .NET Framework 4.5
Compatible Option of StackExchange.Redis nuget package is 1.2.6
When i install and use the same, it gives error: "Not able to Connect"
Just by changing my application to build in .NET Framework 4.6 and not even updating StackExchange.Redis to latest compatible version, my code start working.
I cannot change .NET Framework of my Web application.
Please help.
Is here anyone who have faced this issue?
You can see my demo first. I can use StackExchange.Redis 1.2.6 in .NET Framework 4.5 project. You can download my demo for test, you just need to paste your connectionstr. If no ssl, you also need to change port to 6379.
My CacheConnection like below. No SSL cert.
<add key="CacheConnection" value="pans******he.redis.cache.windows.net:6379,password=*********,ssl=False,abortConnect=False,allowAdmin=true"/>
Why add ,allowAdmin=true, becase below code.
var server = Connection.GetServer(endpoint.Host, endpoint.Port);
var clients = server.ClientList();

Unable to generate deps.json to enable migrations

I use Asp.net core mvc for web developing.
I want to enable entityframework migrations via Entity Framework Core .NET Command Line Tools:
dotnet ef migrations add InitialDatabase
but an error occurs:
unable to generate deps.json, it may have been already generated: C:\Program Files\dotnet\sdk\2.0.2\Sdks\Microsoft.NET.Sdk\build\GenerateDeps\GenerateDeps.proj
Are there any .NET Core configs that I missed?
When I add a service reference to a regular.net core web application, I got the similar error.
Error:Unable to generate deps.json, it may have been already
generated. You can specify the "-d" option before the tool name for
diagnostic output (for example, "dotnet -d ": C:\Program
Files\dotnet\sdk\2.1.502\Sdks\Microsoft.NET.Sdk\targets\GenerateDeps\GenerateDeps.proj
After the investigation I came to know that, somehow svcutil was not installed. Once I installed svcutil using Nuget Package Manager (Install-Package dotnet-svcutil), this issue resolved.
you need to install :
The Windows Communication Foundation (WCF) dotnet-svcutil tool is a
.NET Core CLI tool that retrieves metadata from a web service on a
network location or from a WSDL file, and generates a WCF class
containing client proxy methods that access the web service
operations.
> Install-Package dotnet-svcutil -Version 1.0.4
My project was using dotnet core 2.2. I had to use dotnet-svcutil 1.0.4 because higher versions did not work for me.
Installing dotnet-svcutil did the trick for me. You can search for dotnet-svcutil under "Manage Packages for solution" from Nuget Packages Manager under tools and then install

Is there a way to use enterprise library in .NET Core 1.1.2 web api

I am planning to use Enterprise Library for database access on a Web API project which is going to be built using .Net core app.
But I am unable to install Enterprise library using NuGet as the latest version of Enterprise Library is not compatible with.Net core app framework.
Note, I don't want to use Entity Framework.
Appreciate if the community can help on this.
If you can migrate your application to .Net Core 2.0 which is still in preview mode, but Microsoft promised to release it by Q3 2017, I have forked out the Enterprise Library project and ported that to .Net Core 2.0 which you can find it under this repository:
https://github.com/Chavoshi/EnterpriseLibrary.NetCore
And also this is the Nuget package for Data Application Block:
https://www.nuget.org/packages/EnterpriseLibrary.Data.NetCore
Still there are some missing parts such as OdbcFactory and OleDbFactory which they are not available in .Net ported APIs (Or Nuget package is not published yet), but I am keep working on them to maybe port them by myself or update it since the API will be available. I appreciate anyone who can contribute on this project as well. :)

How to install SignalR.Client.NET35 to a project

I am using SignalR 0.5.3, installed via NuGet, for my .NET 4.5 Web Application - now, since I need to push data from SQL SERVER 2008R2 (supporting only the .NET Framework up to 3.5), I need to create a library using the SignalR .NET 3.5 Client.
I have seen in the project website that there is probably a SignalR.Client.NET35 version but (being not very familiar neither with github nor with NuGet) I have no clue how to install that client for the library project I have to work on.
I have tried installing with the std command install-package SignalR.Client but the message i get is:
Install-Package : Could not install package 'SignalR.Client 0.5.3'.
You are trying to install this package into a project that targets
'.NETFramework,Version=v3.5', but the package does not contain any assembly
references that are compatible with that framework.
For more information, contact the package author.
so it looks like the right .NET version is not picked correctly/out of the box.
Before bothering the author, i thought to give a try round here.
Any suggestions?
We haven't packaged the 3.5 client into the package as yet. You'll need to build from source.
I backported the v1.x and v2.x SignalR clients to NET 3.5. Available as NuGet packages here: http://www.nuget.org/packages/Nivot.SignalR.Client.Net35/

Web Developer 2010 Express does not list 4.0 framework

Whatever I do for several days now, Web Developer 2010 Express does not see 4.0 NET Framework. If to right click on solution properties in the Application – Target Framework it lists 2.0, 3.0 and 3.5, which are NOT installed on my computer but 4.0 which is actually installed. I tried to clean all using dotnetfx_cleanup_tool, reinstalled 4.0 client and full several times, copied reference assemblies to different folders and so on but WDE still does not see it.
I also have SDK for Windows 7 and .NET Framework 4 installed.
Where and how does it find frameworks, does in scan registry or some config file?
To target .NET 2.0/3.0/3.5, you have to install .NET 3.5.
And Web Develoepr requires full profile, not client profile.

Resources