CAFF to CAL - How to work application with multiple Public URL's - cal

We are facing issue after upgrade CAFF to CAL
Previously with CAFF, website is working with both public address:
tco-test.tengizchevroil.com
tco-test-cvx.azurewebsites.net
but now with CAL it works with one public address, provided in RedirectURI
ida:RedirectURI (tco-test.tengizchevroil.com)
stop working with (tco-test-cvx.azurewebsites.net)
Please guide, how to configure our website to start working with both Public Address, defined in app-service

Related

identity server load balancing logout issue

i am working on identity server 4 with .net core micro service architecture, i have followed this reference application please click Here.i have also used docker container to deploy distributed approach application.its working fine when it is in development i.e local environment.
but on production i am using Load balancing on identity server, because of load balancing i am facing log out issue.
Ex . i have created 3 instances of Identity server for production purposes i.e A,B and C, based on user load it will automatically switch between instances.Now the problem is when user logged in A instances after few seconds it automatically requests to B or C instances because of load balancing, so problem is user logged in A instance and current request is handled by B or C instance so how server will know that user is logged in or not,that's why its logging out me and redirects to log in screen.
EDIT :
Please check with Identity server configuration and operational store with signin certificate
I believe the issue you have is due to the data protection in asp.net core, each container will be using different keys to encrypt / decrypt data. To verify just run one instance of the container, if this resolves your problem then look at : https://learn.microsoft.com/en-us/aspnet/core/security/data-protection/
public class XmlToDbRepository : IXmlRepository
{
private readonly IPersistKeyDb _persistKeyDb;
public XmlToDbRepository(IPersistKeyDb persistKeyDb)
{
_persistKeyDb = persistKeyDb;
}
public IReadOnlyCollection<XElement> GetAllElements()
{
return _persistKeyDb.GetAll().Select(i => XElement.Parse(i.Key)).ToList().AsReadOnly();
}
public void StoreElement(XElement element, string friendlyName)
{
_persistKeyDb.Store(friendlyName,element.ToString(SaveOptions.None));
}
}
I think this is the one you'll be interested in.

How do I get started with Redis on Servicestack on Windows?

I've just got started with ServiceStack and have created my first service in MVC4. Now I want to persist my objects using Redis. I can't figure out how to get it running on Windows or if the ServiceStack distribution already has this included. I'm also thinking about using one of the Redis cloud implementations, but I'd like to get it running locally first.
Thanks
You need something like Redis on Windows (here and here, for blog posts about that). You can use the repo stored on github. Once you have that you can build redis in Visual Studio and run it.
Service Stack also has a support page here, including a link to a project that runs Redis as a Windows Service.
Edit. And I've found the project and blog post I played with a month or so ago as well (which coincidentally is written by Jason from stackexchange).
LATE UPDATE Ok, so no sooner had I commented
do more than "download" and "execute installer to get robust service" like you do with Nuget packages
than I find this Redis Nuget that allows you to run Redis from the command line, released by MSOpenTech that you can use with the ServiceStack.Redis package
Edit and this is how you use it:
Create a console application in Visual Studio
Run "manage NuGet packages" in the project console menu on solution explorer
Search for, and install "redis-64" and "ServiceStack.Redis" (you may want to do redis-64 by running install-package redis-64 from the Package Manager Console)
Start redis from packages\Redis-64.\tools\redis-server.exe by cmd prompt or double click
(If asked about windows firewall, just cancel to keep comms on the local machine)
run the following code:
public class Message {
public long Id { get; set; }
public string Payload { get; set; }
}
static void Main(string[] args) {
List<string> messages = new List<string> {
"Hi there",
"Hello world",
"Many name is",
"Uh, my name is"
};
var client = new RedisClient("localhost");
var msgClient = client.As<Message>();
for (int i = 0; i < messages.Count; i++) {
Message newItem = new Message {
Id = msgClient.GetNextSequence(),
Payload = messages[i] };
msgClient.Store(newItem);
}
foreach (var item in msgClient.GetAll()) {
Console.WriteLine("{0} {1}", item.Id, item.Payload);
msgClient.DeleteById(item.Id);
}
Console.WriteLine("(All done, press enter to exit)");
Console.ReadLine();
}
Output:
1 Hi there
2 Hello world
3 Many name is
4 Uh, my name is
(All done, press enter to exit)

issue in consuming wcf service in mvc 4

I'm having a class and interface like this in my wcf application IService1.cs
[ServiceContract]
public interface IService1
{
[OperationContract]
string insertValues(empInfo objInfo);
}
[DataContract]
public class empInfo
{
string _organizationName = string.Empty;
string _organizationAddr = string.Empty;
int? _totalemp;
}
And in Service1.svc.cs, i have implemented that interface.
public class Service1 : IService1
{
public string insertValues(empInfo objInfo)
{
.....
}
}
then i have created a empty mvc4 client application to consume this wcf service.
i have added the ServiceReference,Now its appear in the service reference folder as ServiceReference1.Then i did this
1. created a controller named Defalut1controller.
2. In this controller i try to add the following line
ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client();
inside the ActionResult. But unable to get the ServiceReference1 word.
its (ServiceReference1) appearing when i update my service like this
From - string insertValues(empInfo objInfo); - To - string insertValues(string objInfo);
and now i have build this wcf application, and update the service reference in my client mvc4 application. Now the
ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client();
line is enabled.
I have tried with the .net web application to consume the same, i can able to do without any problem, what i have missed with mvc4, please help. thanks in advance..
I got the answer, thanks to stackoverflow.
This is the solution:
Right click on Service Reference
Select Configure Service Reference
Select Reuse types in specified referenced assemblies
Just select everything except "Newtonsoft.json"
It worked for me as well.
The question itself and the problem you are facing is a bit unclear for me but have you actually tried exposing any public properties on your empInfo data contract? Cause right now you have only 3 private fields which will not be generated in the proxy code on the client side.
Microsoft has fixed this issue in this update: http://support.microsoft.com/kb/2750149

webmethod receiving null parameters on ios call

I'm developing an iOS app and it calls a Web service I wrote using mono and it runs using apache. However, when I call the webmethod, the parameters received are always null for example in this call (im using Appcelerator)
callparams = {
username: String(username),
password: String(password)
};
alert(String(username) + String(password));
try {
suds.invoke('Login', callparams, function(xmlDoc){
On the server, i have this webmethod
[WebMethod]
public string Login(string username, string password)
{
return username + "-00";
}
When I run the simmulation, i only receive "-00" and not the username! why is this happening? I've also tried with integers and they're null too..
Nonetheless this works perfectly if i use the test form of the service..
Im running on MacOX 10.7.2 with mono 2.8.2 apache 2...
Thanks in advance
As far I know you can not do this with mono services under fast-cgi-monoserver ou mod_mono. Use an alternative to asmx (our PageMethod) like ServiceStack.

ASP.NET MVC Facebook

I am trying to do a seemingly simple thing, but having trouble accomplishing it. I am trying to automate the posting on my Facebook wall. Basically I have a ASP.NET MVC website that I post updates on, and I want to automatically submit the post to my wall.
I see a lot of stuff on FB Connect and getting data, I just want to post.
Thanks for any help or guidance.
UPDATE: Just trying to resurrect and be a little more clear in my description as I am not getting anywhere.
I have a page that I want with a text box and a button. When I submit the form I want the message to post to my Facebook wall. I thought it was Facebook Connect, but I am getting no where as to how to automatically authenticate myself and post to my wall.
I would like to use C# rather than JavaScript.
private const string ApplicationKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXX";
private const string SecretKey = "XXXXXXXXXXXXXXXXXXXXXXXXXX";
private Facebook.Rest.Api _facebookAPI;
private Facebook.Session.ConnectSession _connectSession;
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Index(FormCollection form)
{
_connectSession = new Facebook.Session.ConnectSession(ApplicationKey, SecretKey);
if (_connectSession.IsConnected())
{
_facebookAPI = new Facebook.Rest.Api(_connectSession);
string response = _facebookAPI.Stream.Publish("This is a generated test");
}
return View();
}
}
The IsConnected() is returning false.
Any help is appreciated.
This code was right, the problem was that I had not added my application to my profile. Dumb miss, but my thought is that the whole thing is poorly documented. I have another issue with offline access, but that is for a different post.
string apiKey = "XXXXXXXXX";
string apiSecret = "XXXXXXXXXXXX";
Facebook.Session.ConnectSession._connectSession = new Facebook.Session.ConnectSession(apiKey, apiSecret);
if (_connectSession.IsConnected)
{
Facebook.Rest.Api api = new Facebook.Rest.Api(_connectSession);
string response = api.Stream.Publish("Test", null, null, null, api.Users.Session.UserId);
}
It could be that you tested your Website on your localhost. The Facebook Cookie is not written out, when you test your Website on localhost. See this link http://forum.developers.facebook.net/viewtopic.php?pid=247332
This might solve your problem:
Add "127.0.0.1 localhost.local" to your file
Update your FB application Connect settings to use "http://localhost.local/" URL and "localhost.local" domain.
Create an IIS Web site on port 80 with the name "localhost.local". I had to stop my default web site, which is also on port 80
Update my Visual Studio 2010 web application to use IIS with the "http://localhost.local/" url.
To see cookies, make sure to install FireCookies, along with FireBug.

Resources