How can I share a simple string value (config) between two web applications asp.net and asp.net core in IIS? - asp.net

How can I share a simple string value (config) between two web applications asp.net and asp.net core in IIS?
I don't want to use cookies

In my opinion, we could achieve this in the following ways,
Web service, such as WCF.
One application is used to create and host WCF service. Another application is used to consume the service.
Create and host the service in a web application by using the default WCF project template in Visual Studio or directly adding an SVC file to the current web project.
https://learn.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-host-a-wcf-service-in-iis
https://www.c-sharpcorner.com/UploadFile/4d56e1/how-to-create-and-consume-wcf-services/
Consume the service.
https://learn.microsoft.com/en-us/dotnet/core/additional-tools/wcf-web-service-reference-guide
Shared sessions stored in the same database.
Passing session data between ASP.NET web applications
Sharing sessions across applications using the ASP.NET Session State Service
Feel free to let me know if there is anything I can help with.

Related

How to configure and call non-anonymous WCF services from SharePoint application and WPF?

We have a CRM/ERP web application (ASP.Net Forms) running on top of SharePoint (WSS and 201x).
On the other hand we have add-ins for Office (WPF) closely integrated to the web application via WCF services.
Both rely heavily on a WCF services project, in three ways:
WCF services called from code behind
AJAX-enabled client web services using webhttpbinding / enablewebscript
WCF services called from the add-ins.
However, there is a security concern.
In our current set-up, the WCF services need to be set to Anonymous authentication.
Otherwise our web application and add-ins won't work using the current configuration.
Our goal: to disable the anonymous access to the WCF services somehow, without breaking either the web application or add-ins.
This proved much less straight-forward than expected.
This is our typical set-up:
Extended SharePoint site (WSS / 201x). Alternate Access Mapping
configuration:
Default: Active Directory, NTLM.
Intranet: Membership Provider, Anonymous access.
ASP.Net web application runs within the main SharePoint web application (no sub web application in IIS).
WCF services project is configured in IIS as a 'sub' web application beneath the SharePoint web application.
This is what we came up with so far:
Added in the WCF services web.config
Changed Windows Authentication -> Advanced Settings to the following:
Extended Protection: Accept
[X] Enable Kernel-mode authentication
Changed client binding configuration of add-ins and web application to Security Mode TransportCredentialOnly with clientCredentialType Ntlm.
Above solution works in our SharePoint 2007 test environment in all three aforementioned places.
However in SharePoint 201x we can't get the WCF calls from within the web application to work.
At least not using the same client bindings as the add-ins (while the WCF calls from the add-ins also work in SharePoint 2013).
The error message we’re getting is: No credentials are available in the security package.
Another one we encountered is: Provider type not defined. (Exception from HRESULT: 0x80090017)
Question: How can we use WCF services non-anonymously from within a SharePoint web application and from WPF?
Any idea's on how to configure and call these in this scenario? (one way or another)
Any thoughts on this are greatly appreciated!

Host ASP.NET App In WCF or Generic Web Server

Objective:
We have a Windows Service/generic EXE that also hosts a WCF service (.Net 3.5). I'd like to be able to take a third party ASP.NET component in a DLL, and host it through that WCF Service.
Is this possible to do, in any way?
It seems like if you want to host a ASP.NET app, it must be through IIS, but we don't use IIS.
Is there any way that we could load the ASP.NET app into memory, make the app available through an endpoint, and receive requests back from the app?
Specifically, we'd like to take the "Microsoft.ReportViewer.WebForms.dll", expose the web form in a web page, and accept any requests back from the web form.
http://msdn.microsoft.com/en-us/library/ms251723.aspx
Looking for anything to get me started. Thx.
From owin.org
"OWIN defines a standard interface between .NET web servers and web applications. The goal of the OWIN interface is to decouple server and application, encourage the development of simple modules for .NET web development, and, by being an open standard, stimulate the open source ecosystem of .NET web development tools."
Essentially Owin implementations, like Katana (OWIN implementations for Microsoft servers and frameworks.), help you self host web apps, even in a Windows NT Service.
According to this post, hosting a WebForms app outside IIS/ASP.NET is not possible.
WebForms are tightly coupled to ASP.NET/IIS and cannot run directly on
OWIN/Katana (e.g. outside of ASP.NET/IIS). However, you should be able
to use Katana's middleware (Security, CORS, etc.) in a WebForms
application.
http://katanaproject.codeplex.com/discussions/571291

How to add wcf functionality to an existing asp.net website project

I have several asp.net website projects for various sites.
Currently I want to add REST API's to these projects so I can start developing mobile apps (using HTML5/JavaScript/CSS3 and PhoneGap) that make use of these webservices.
Since WCF is far more powerful than regular asp.net webservices (among others with control over the service and authentication/authorization), I'd love to add these to my existing website project.
I did a Google search but cant find anywhere a step-by-step tutorial how this can be done. And also if there's any functionality I'd possibly loose when adding WCF functionality
I was also thinking of creating a new project specifically for WCF, but think I'd rather add it to an existing website project.
Can anyone help me with this?
Depending on exactly what your needs are and how your current web site is configured, there are two approaches.
If you are using a Web Site Project, then you should create your WCF service in a different application:
1) Create a new ASP.Net Web Application Project.
2) Add a new item to the project and select the type of WCF Service or WCF Data Service.
When you deploy this project, you will deploy it to your web server, but not as part of your web site since configuring the web.config will be a large manual effort.
If you are using a Web Application Project, then you could add the WCF Service directly to your existing project. However, I only recommend this approach if you are Silverlight applets within the web site that rely on the user's authenticated credentials.
WCF can be configured with a lot of bindings and it can be configured to return xml or json(.net 4.0). Try to create a wcf service configured to use basichttpbinding or wsHttpBinding and to format the response as json and use jquery to interact with the wcf service. This article might help you http://www.codeproject.com/KB/aspnet/Cross_Domain_Call.aspx

How to set WCF security when Calling WCF from a web applicaion that shares same ASPNET membership with WCF service?

NET web application and a WCF Application that share the same ASP.NET membership database.
They are both sharing the same ASP.NET membership database.
It is basically like:
WCF: is https://ServerName/Services.svc
ASP.NET: is https://ServerName/Default.aspx
(both are two virtual folders in the same web application and both are using the same ASP.NET membership database).
The user logs on to the ASP.NET application and can then decide to call the WCF service.
What are my options for setting the security for the call between the ASP.NET and the WCF service that make the call using the credentials supplied by the user when logging to the ASP.NET application?
If you run you application in ASP.Net Compatibility mode. You will get all the security features available with ASP.Net. Things such as HttpContext.Current.User will point to the logged in user.
For the fastest implementation (by fastest I mean to get up and running) get Juval Lowy`s ServiceModelEx library from http://www.idesign.net and use his declarative security library.
I have used this library a lot and it works well.

Hosting a Silverlight compatible Web Service in a Windows Service

Is it possible to create a Windows Service (background apps accessible in services.msc) application and host an ASP.NET WebService or a Silverlight compatible WebService within it?
I want to create a WebService that performs COM interop calls to something and decided that a Windows Service that interfaces with COM directly as well as hosting the WebService would be the most flexible way to go. I can then create a ASP.NET website and Silverlight application to interact with the WebService.
The other way is to have the ASP.NET perform the COM interop calls on the server side but how safe is this and does .NET even allow that?
You cannot host an ASMX web service in a Windows Service. You can, and should, do it with WCF, which replaces ASMX.
On the other hand, there's no reason you can't use COM interop in an ASP.NET application, as easily as you can with any other .NET application. The only thing to be aware of is multithreading; since it will be called from a service, your COM object will be getting called on multiple threads, which it may not expect.

Resources