I would like to host an ASP.Net core server in a UWP project, more specifically - I would like to host a REST service in a Background App on Windows IoT Core.
This would give 2 benefits:
I'm not sure whether this is the right repo since it relates to both ASP.Net Core and UWP.
@jkotas suggested that this is a duplicate of aspnet/Home#1531; however I don't think it is a 1:1 duplicate. It seems that aspnet/Home#1531 is about running Asp.Net Core on Windows IoT Core in general, which is possible now already with .net core 2 for arm.
My question was broader - to allow an ASP.Net Core webserver to be hosted in UWP apps. The Windows IoT Core usecase as described above is an example of what you could do with that.
Other usecases could be to temporarily run a website when running an UWP app, e.g. to upload photos from a phone to use in that app.
@DamianEdwards / @glennc / @shirhatti / @davidfowl - thoughts on this issue?
AFAIK we have no plans to support this in a first class way.
Closing because there are no plans to implement this.
It got 192 votes and is in the top 10 feature requests for Asp.Net core. So why wouldn't you plan to support it? Is the feedback system at Microsoft broken?
@JeffMushmo we take into account all feedback, but this is not currently a priority for the product, as balanced against other competing requirements.
This is not a scenario we intend to block, so if someone runs into a specific issue while attempting to implement this, we would look at ways to collaborate. But we have no plans to proactively do work in this space.
We would like to collaborate on fixing this. We build devices that we sell for 5 figures per unit that run Windows IoT Core for the operating system. We're on track to be selling thousands of these devices very soon.
The only solution Microsoft provides us with to remotely install/update applications with, only works with UWP applications. We understand we can run .NET Core on Windows IoT Core perfectly fine. But these apps aren't able to be installed/updated the same way an Appx package is.
We have a main service that controls our instruments and all of the control for that services is exposed via a Web Api. Right now we're using a homegrown "simple" web server because Asp.net core still isn't supported. For obvious reasons, this makes Api development challenging.
@los93sol got Asp.net core compiling for UWP here: https://github.com/aspnet/Mvc/issues/7128
We've also managed to get Asp.Net core working, based off of his example, in Debug mode. When compiling for Release mode (specifically .NET Native compilation) this is the error we get:
MCG : warning MCG0001: [MarshalAs(UnmanagedType=(Default), ElementType=(Default))] with type 'Microsoft.DiaSymReader.VariantStructure' is not supported.This signature is located on 'System.Void Microsoft.DiaSymReader.ISymUnmanagedWriter5.DefineConstant2(System.String, Microsoft.DiaSymReader.VariantStructure, System.Int32)'.
MCG : warning MCG0007: Unresolved P/Invoke method 'ncrypt.dll!NCryptCloseProtectionDescriptor' for method 'System.Int32 Microsoft.AspNetCore.Cryptography.UnsafeNativeMethods.NCryptCloseProtectionDescriptor(System.IntPtr)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'ncrypt.dll!NCryptCreateProtectionDescriptor' for method 'System.Int32 Microsoft.AspNetCore.Cryptography.UnsafeNativeMethods.NCryptCreateProtectionDescriptor(System.String, System.UInt32, Microsoft.AspNetCore.Cryptography.SafeHandles.NCryptDescriptorHandle)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'ncrypt.dll!NCryptGetProtectionDescriptorInfo' for method 'System.Int32 Microsoft.AspNetCore.Cryptography.UnsafeNativeMethods.NCryptGetProtectionDescriptorInfo(Microsoft.AspNetCore.Cryptography.SafeHandles.NCryptDescriptorHandle, System.IntPtr, System.UInt32, Microsoft.AspNetCore.Cryptography.SafeHandles.LocalAllocHandle)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'ncrypt.dll!NCryptProtectSecret' for method 'System.Int32 Microsoft.AspNetCore.Cryptography.UnsafeNativeMethods.NCryptProtectSecret(Microsoft.AspNetCore.Cryptography.SafeHandles.NCryptDescriptorHandle, System.UInt32, System.Byte*, System.UInt32, System.IntPtr, System.IntPtr, Microsoft.AspNetCore.Cryptography.SafeHandles.LocalAllocHandle, System.UInt32)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'ncrypt.dll!NCryptUnprotectSecret' for method 'System.Int32 Microsoft.AspNetCore.Cryptography.UnsafeNativeMethods.NCryptUnprotectSecret(System.IntPtr, System.UInt32, System.Byte*, System.UInt32, System.IntPtr, System.IntPtr, Microsoft.AspNetCore.Cryptography.SafeHandles.LocalAllocHandle, System.UInt32)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'ncrypt.dll!NCryptUnprotectSecret' for method 'System.Int32 Microsoft.AspNetCore.Cryptography.UnsafeNativeMethods.NCryptUnprotectSecret(Microsoft.AspNetCore.Cryptography.SafeHandles.NCryptDescriptorHandle, System.UInt32, System.Byte*, System.UInt32, System.IntPtr, System.IntPtr, Microsoft.AspNetCore.Cryptography.SafeHandles.LocalAllocHandle, System.UInt32)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'kernel32.dll!GetModuleHandleExW' for method 'System.Boolean Microsoft.AspNetCore.Cryptography.SafeHandles.SafeLibraryHandle.UnsafeNativeMethods.GetModuleHandleEx(System.UInt32, Microsoft.AspNetCore.Cryptography.SafeHandles.SafeLibraryHandle, System.IntPtr)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'kernel32.dll!LoadLibraryExW' for method 'Microsoft.AspNetCore.Cryptography.SafeHandles.SafeLibraryHandle Microsoft.AspNetCore.Cryptography.SafeHandles.SafeLibraryHandle.UnsafeNativeMethods.LoadLibraryEx(System.String, System.IntPtr, System.UInt32)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'tokenbinding.dll!TokenBindingVerifyMessage' for method 'System.Int32 Microsoft.AspNetCore.HttpSys.Internal.UnsafeNclNativeMethods.TokenBindingVerifyMessage(System.Byte*, System.UInt32, System.Char*, System.Byte*, System.UInt32, Microsoft.AspNetCore.HttpSys.Internal.HeapAllocHandle)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'libc!setsockopt' for method 'System.Int32 Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransport.setsockopt(System.Int32, System.Int32, System.Int32, System.IntPtr, System.UInt32)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'Microsoft.DiaSymReader.Native.x86.dll!CreateSymReader' for method 'System.Void Microsoft.DiaSymReader.SymUnmanagedFactory.CreateSymReader32(System.Guid, System.Object)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'Microsoft.DiaSymReader.Native.amd64.dll!CreateSymReader' for method 'System.Void Microsoft.DiaSymReader.SymUnmanagedFactory.CreateSymReader64(System.Guid, System.Object)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'Microsoft.DiaSymReader.Native.x86.dll!CreateSymWriter' for method 'System.Void Microsoft.DiaSymReader.SymUnmanagedFactory.CreateSymWriter32(System.Guid, System.Object)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'Microsoft.DiaSymReader.Native.amd64.dll!CreateSymWriter' for method 'System.Void Microsoft.DiaSymReader.SymUnmanagedFactory.CreateSymWriter64(System.Guid, System.Object)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'kernel32!LoadLibrary' for method 'System.IntPtr Microsoft.DiaSymReader.SymUnmanagedFactory.LoadLibrary(System.String)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'mscoree.dll!CLRCreateInstance' for method 'System.Object Microsoft.CodeAnalysis.Interop.ClrStrongName.nCreateInterface(System.Guid, System.Guid)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'libc!sysctl' for method 'System.Int32 Microsoft.DotNet.PlatformAbstractions.Native.NativeMethods.Darwin.sysctl(System.Int32*, System.UInt32, System.Byte*, System.UInt32*, System.IntPtr, System.UInt32)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'ntdll!RtlGetVersion' for method 'System.Int32 Microsoft.DotNet.PlatformAbstractions.Native.NativeMethods.Windows.RtlGetVersion(Microsoft.DotNet.PlatformAbstractions.Native.NativeMethods.Windows.RTL_OSVERSIONINFOEX)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'advapi32.dll!RegCloseKey' for method 'System.Int32 Interop.Advapi32.RegCloseKey(System.IntPtr)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'advapi32.dll!RegOpenKeyExW' for method 'System.Int32 Interop.Advapi32.RegOpenKeyEx(Microsoft.Win32.SafeHandles.SafeRegistryHandle, System.String, System.Int32, System.Int32, Microsoft.Win32.SafeHandles.SafeRegistryHandle)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'advapi32.dll!RegEnumValueW' for method 'System.Int32 Interop.Advapi32.RegEnumValue(Microsoft.Win32.SafeHandles.SafeRegistryHandle, System.Int32, System.Char[], System.Int32, System.IntPtr, System.Int32[], System.Byte[], System.Int32[])'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'advapi32.dll!RegSetValueExW' for method 'System.Int32 Interop.Advapi32.RegSetValueEx(Microsoft.Win32.SafeHandles.SafeRegistryHandle, System.String, System.Int32, Microsoft.Win32.RegistryValueKind, System.String, System.Int32)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'advapi32.dll!RegSetValueExW' for method 'System.Int32 Interop.Advapi32.RegSetValueEx(Microsoft.Win32.SafeHandles.SafeRegistryHandle, System.String, System.Int32, Microsoft.Win32.RegistryValueKind, System.Char[], System.Int32)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'advapi32.dll!RegSetValueExW' for method 'System.Int32 Interop.Advapi32.RegSetValueEx(Microsoft.Win32.SafeHandles.SafeRegistryHandle, System.String, System.Int32, Microsoft.Win32.RegistryValueKind, System.Byte[], System.Int32)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'advapi32.dll!RegSetValueExW' for method 'System.Int32 Interop.Advapi32.RegSetValueEx(Microsoft.Win32.SafeHandles.SafeRegistryHandle, System.String, System.Int32, Microsoft.Win32.RegistryValueKind, System.Int32, System.Int32)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'advapi32.dll!RegSetValueExW' for method 'System.Int32 Interop.Advapi32.RegSetValueEx(Microsoft.Win32.SafeHandles.SafeRegistryHandle, System.String, System.Int32, Microsoft.Win32.RegistryValueKind, System.Int64, System.Int32)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'advapi32.dll!RegQueryInfoKeyW' for method 'System.Int32 Interop.Advapi32.RegQueryInfoKey(Microsoft.Win32.SafeHandles.SafeRegistryHandle, System.Text.StringBuilder, System.Int32[], System.IntPtr, System.Int32, System.Int32[], System.Int32[], System.Int32, System.Int32[], System.Int32[], System.Int32[], System.Int32[])'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'advapi32.dll!RegQueryValueExW' for method 'System.Int32 Interop.Advapi32.RegQueryValueEx(Microsoft.Win32.SafeHandles.SafeRegistryHandle, System.String, System.Int32[], System.Int32, System.Byte[], System.Int32)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'advapi32.dll!RegQueryValueExW' for method 'System.Int32 Interop.Advapi32.RegQueryValueEx(Microsoft.Win32.SafeHandles.SafeRegistryHandle, System.String, System.Int32[], System.Int32, System.Int64, System.Int32)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'advapi32.dll!RegQueryValueExW' for method 'System.Int32 Interop.Advapi32.RegQueryValueEx(Microsoft.Win32.SafeHandles.SafeRegistryHandle, System.String, System.Int32[], System.Int32, System.Int32, System.Int32)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'advapi32.dll!RegQueryValueExW' for method 'System.Int32 Interop.Advapi32.RegQueryValueEx(Microsoft.Win32.SafeHandles.SafeRegistryHandle, System.String, System.Int32[], System.Int32, System.Char[], System.Int32)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
MCG : warning MCG0007: Unresolved P/Invoke method 'advapi32.dll!RegCreateKeyExW' for method 'System.Int32 Interop.Advapi32.RegCreateKeyEx(Microsoft.Win32.SafeHandles.SafeRegistryHandle, System.String, System.Int32, System.String, System.Int32, System.Int32, Interop.Kernel32.SECURITY_ATTRIBUTES, Microsoft.Win32.SafeHandles.SafeRegistryHandle, System.Int32)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
Generating code...
Interop code generated.
Compiling interop code
error : ILT0014: Failed to compile interop source code. See the build log for error details.
It seems as though the Microsoft.AspNetCore nuget package has dependencies on DLLs which have DllImports not supported by the UWP runtime.
We've already considered hybrid application options, where some is in UWP and the Asp.net core stuff is in .NET Core. But this comes with its own set of challenges.
At this point, I'm guessing it would be best to branch the Asp.net repo and remove the references to things like IIS Integration from the branched codebase. But from my initial digging, I cannot find where the source code for that package exists.
@JeffMushmo which source code are you unable to find?
The "Microsoft.AspNetCore" nuget package.
@JeffMushmo I’m glad someone got some use out of that experiment :)
Ok. I think I've got it working.
@Eilon Your guidance on next steps would be appreciated.
Here's what I did:
Haven't fully tested this with our application. But it is now passing all of the tests that are in the MetaPackages solution. Things like MVC, SignalR have not been tested. But with the sample code working now, those features should work as expected.
We would like to distribute this as a nuget package. We have our own internal nuget repository. But I'm wondering if it makes more sense to create a pull request so this can be a part of the official Asp.Net Core release stuff.
I would prefer the latter because I'm not sure what it will take to integrate this solution with our own automated build process.
Hi @JeffMushmo that's cool you got all that working! As for right now, there are no plans for UWP support, so we're not planning on publishing a NuGet package for this. It would be great if you ended up publishing the package and it would be a good way to gauge community interest around this scenario.
@Eilon, what is the best way for the community to express our interest in having this as an official NuGet package? This is something that would be very useful for UWP development :)
As politely as I can put this: It's extremely unfortunate that the community interest up to this point isn't enough to motivate Microsoft to support this. UWP is Microsoft's platform. Asp.Net Core is supposed to run on multiple platforms. This gap exists as a result of Microsoft's decision not to support UWP. Which paints a pretty bad picture on their dedication to Windows 10 IoT Core, Azure IoT Edge, Azure IoT Hub, and UWP as a whole.
Would be nice if Microsoft reconsiders all of the feedback on the issue, considering it's from developers who extensively use these technologies collectively, rather than the folks building the individual technologies.
Thanks for the feedback again, I'm following up with some others to see if there's anything more we can do here.
For the record, while I think I got passed the IIS errors, it appears there are still PInvokes keeping it from building with the native compiler. It would be likely that me or someone on my team will have to significantly ramp up on the entire Asp.Net core codebase before being able to trace down the issues. Part of the problem is the convoluted build process as well as lack of documentation for the source code.
@JeffMushmo we're actually working on a project to improve the build system in the coming months, though there's nothing much to share on that front just yet. If you can share some of the specific issues you're hitting, we can try to help investigate.
ASP.NET Core was never designed with UWP in mind, you're likely hitting issues that are just the tip of the iceberg. AOT compilation (ProjectN) will very likely break your application and that's to do with larger design choices that were made when this project was being invented (5 years ago now).
There may be a better way to integrate with Windows 10 IoT Core that we're not aware of right now but we'd need to investigate.
Just for my 2 cents. I've been developing with Microsoft technologies since 1985. I personally know Scott Guthrie and believe he would be appalled at these responses. We currently build high end IOT instruments and want to use ASP.NET CORE for webapi control of IOT CORE instruments. We downloaded the example Jeff mentioned and with a few mods have it working in debug mode. But not building in release mode native compilation. We aren't allowing JIT compilation as our webapi doesn't change much and is well controlled. But we need native compilation for performance. In a UWP background task you are able to use .NET CORE libraries and if ASP.NET CORE is built on top of .NET CORE one would think there shouldn't be an issue. I went to BUILD 2018 as VP of Software Engineering and understood that the push was Azure, IOT, IOT CORE and Machine learning. When it comes to the rubber meeting the road, this can't hold up in the real world. Please reconsider an officially supported package, so we can continue to be productive. These issues are concerning as we weigh the need to develop for Azure Sphere. Thanks for your time.
Almost 200 votes on uservoice…
Apparently there are a lot of people who want this. Hope that the Asp.Net Core team will still consider this.
@davidfowl @Eilon if, as you say, ASP.Net Core is not designed with UWP in mind; would there then be an alternative way of hosting at least a REST API in an UWP app without the need for rendering pages etc?
We are also interested in full support has have dependencies in our UWP Applications Universal Windows class libaries that contain NetStandard 2.0 nuget packages - when it comes to compile to .Net Native the world and its auntie complains about P/Invoke and missing Assemblies
I have already added the Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets package via nuget but am still getting:
Universal Windows class library targeting min max 16299 deploying to ARM based processor
MCG : warning MCG0007: Unresolved P/Invoke method 'libc!setsockopt' for method 'System.Int32 Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransport.setsockopt(System.Int32, System.Int32, System.Int32, System.IntPtr, System.UInt32)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.
Any ideas
Most helpful comment
@JeffMushmo I’m glad someone got some use out of that experiment :)