Windows Azure In-Role Caching Exception issue - c#

I am getting this exception :-
ErrorCode:SubStatus:There is a temporary failure. Please retry later. (One or more specified cache servers are
unavailable, which could be caused by busy network or servers. For
on-premises cache clusters, also verify the following conditions.
Ensure that security permission has been granted for this client
account, and check that the AppFabric Caching Service is allowed
through the firewall on all cache hosts. Also the MaxBufferSize on the
server must be greater than or equal to the serialized object size
sent from the client.). Additional Information : The client was trying
to communicate with the server: net.tcp://RoleName:24233.
I have followed this :- Documentation and there are lots of questions and article there but they are little bit old.
Client creation :-
var cacheFactory = new DataCacheFactory();
_cacheClient = (string.IsNullOrWhiteSpace(cacheName))
? cacheFactory.GetDefaultCache() : cacheFactory.GetCache(cacheName);
WebConfig :-
<dataCacheClients>
<dataCacheClient name="default" >
<autoDiscover isEnabled="true" identifier="RoleName" />
</dataCacheClient>
Retry Policy :- It is inbuild now DataCacheFactory with interval of 1 minute and 60 recount.
I have latest nuget packages like Windows.azure.caching with version 2.5. So does anybody has solved this problem recently. i am quite a stuck here. any help is appreciated.

After hit and trial we have found that you should have the latest versions of both Windows Azure Tools and Windows Azure Cache libraries. What you can do is just install the latest Windows.Azure.Cache and then go to you publish azure settings project. Right click go to Properties => Application tab then upgrade the Windows Azure tools to latest version. And now everything will work like a charm :)
Hope it will save someone else day :)

Related

Properly configuring a dotnet (ASP.NET Core 2.1) environment on CentOS / Linux

I'm stuck, I'm really hoping someone can help or at least point me in the right direction. My end goal is to get my ASP.NET Core 2.1 app running on a CentOS Linux box. Since I'm using a mongo db in my actual app and wanted to eliminate any possible issues with that, I published a plain-jane asp.net core 2.1 mvc app, no authentication, and deployed it to a virtual host on my centos 7 box (apache upgraded via CoreIT to 2.4.37 since centos distros still deploy the older 2.4.6 version).
For the scope of this question I think I just need to make sure my reverse proxy is working properly and need help in pinning down that. I've followed instructions from here and the Microsoft setup doc from here. These 2 links are what I've been working with mainly.
When my app service is running, I can do a curl localhost:5000 and see the correct html of my homepage being returned. When I try from command line again with test.mydomain.com or test.mydomain.com:5000 it just times out. If I go to my app's conf (test.mydomain.com.conf in /etc/httpd/sites-available) and remove the ProxyPass, ProxyPassReverse and ProxyPreserveHost lines then I can hit test.mydomain.com from the outside with a browser and get my index.html file up and displaying properly (this is just one index.html file and not a part of the dotnet app though). It's only when I add the below back into my conf file it just hangs up when I try and hit the URL. I'm not sure what to look for in journalctl or maybe I should tail a specific log file to find out what it's waiting on and why it's taking so long.
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
Somehow is seems like my reverse proxy isn't set up right to be accessed from outside the box.
The rest of my app's config below.
<VirtualHost *:*>
RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}</VirtualHost>
<VirtualHost *:80>
ServerName test.mydomain.com
DocumentRoot /var/www/test.mydomain.com/public_html
ErrorLog logs/dashboard.crtv1.com.errorlog
CustomLog logs/dashboard.crtv1.com.access_log combined
</VirtualHost>
I think I addressed the issue although I'm not sure what issues I was actually having at the time of posting. I ended up through process of elimination and curl to find another service was running and using port 5000 in another virtual host - we're doing development and need a test, staging and production set of virtual hosts. Also I found I had some code in my app (UseUrls) that was specifically stating to use port 5000 so multiple copies of it within the same environment had resource conflicts. I'll circle back and update which environments will use which ports and hopefully have a nice set up.

CMS.DataEngine.LicenseException in Kentico

I am working on E-commerce project using Kentico 9, we used only Administration part of Kentico and designed our own front-end, we installed Kentico on our server and deployed our webservice that extracting data like product details and so on using Kentico APIs but we got the following exception in some cases that needs API to talk to database like:
var custmerID = CustomerInfoProvider.GetCustomerInfoByUserID(userID);
How ever it was working just fine in my PCs webservice thrown error when we deployed it on server:
License for feature 'Ecommerce' not found.
CMS.DataEngine.LicenseException: License for feature 'Ecommerce' not found.
at CMS.LicenseProvider.LicenseHelperInternal.ReportLicenseError(String redirectUrl, String message)
at CMS.LicenseProvider.LicenseService.CheckLicense(FeatureEnum feature, String domain, Boolean throwError)
at CMS.DataEngine.AbstractInfoProvider`3.GetObjectQuery(Boolean checkLicense)
at CMS.Ecommerce.CustomerInfoProvider.GetCustomerInfoByUserIDInternal(Int32 userId)
at SCTH.MAS.KNDAL.User.CheckifCustomerExist(Int32 userID, String siteName) in C:\Users\Administrator\Documents\Visual Studio 2015\Projects\SCTH.MAS.KNDAL\SCTH.MAS.KNDAL\User.cs:line 39
at SCTH.MAS.KNDAL.User.CheckUserAvailabilityForBuying(String userEmail, String siteName) in C:\Users\Administrator\Documents\Visual Studio 2015\Projects\SCTH.MAS.KNDAL\SCTH.MAS.KNDAL\User.cs:line 29
at SCTH.MAS.KNDAL.KenticoWebServices.CheckUserAvailabilityForBuying(String userEmail, String siteName) in C:\Users\Administrator\Documents\Visual Studio 2015\Projects\SCTH.MAS.KNDAL\SCTH.MAS.KNDAL\KenticoWebServices.asmx.cs:line 90
Notice that:
We used free license till now.
Our site is multi-culture.
We have one custom table in our application.
Kentico in our production system will be on different server than DB server so if we Kentico has webfarm configuration we should configure it.
Can any one help us is it license issue or configuration issue or what?
Diaa,
It appears you either do not have the license key installed yet, or there is something going on that it is not seeing the license key. You must have at least a CMS Base license to use the ECommerce features. If you have the license installed and are still getting this error, try going to your System settings in the admin console, dump the cache and restart the application. It could be that it has just gotten stuck.
And when you say free version, do you mean you have been using a trial version? If so, then if the trial license expired you would expect to get this error as well.
Even if you are calling something via the API, Kentico checks the licensing is correct during each call, so you need to make sure your licensing is correct.
If you have the "free" license key installed and you are trying to make calls which are not part of the free license then you could get this error.
Secondly, when you "installed" Kentico, if you modified the installation and didn't install the modules then there is no database representation or physical code files available so this could also cause your problem.
To make sure your calls or website see the new key, recycle the application pool for the website. This will ensure there is no cached connection.

Update to Azure Application Insights 1.1, now data is not sent

I'm tracking metrics from WPF application. I have updated Application Insights DLLs from 0.17 to 1.1. This meant removing Old DLLs and adding the SDK via Nuget. Now i don't see my metrics/events in the portal. I see no activity in the debugger output window.
Activating DeveloperMode don't seem to do anything.
TelemetryConfiguration.Active.TelemetryChannel.DeveloperMode = true;
I can see that the AI DLLs are placed correctly in the output folder, and I get no error messages when sending events. But no data seems to come through any more.
I have tried to check traffic with fiddler. But no data seems to be sent. I have already tried to do what is suggested here:
https://azure.microsoft.com/en-us/documentation/articles/app-insights-troubleshoot-faq/#how-do-i-upgrade-from-older-sdk-versions
Any suggestions to what could be the problem?
Solution:
Make sure the ApplicationInsights.config properties is set to
"Always copy"
or
"Copy if newer"
Bonus:
How to configure 1.1
https://azure.microsoft.com/en-us/documentation/articles/app-insights-configuration-with-applicationinsights-config/
In the newer 1.1 SDK setting up should be simpler. You can simply new up a telemetryClient to send. You shouldn't need any additional config file or additional code.
tc = new TelemetryClient();
tc.InstrumentationKey = "GET YOUR KEY FROM THE PORTAL";
tc.TrackEvent("SampleEvent");
Some additional details about getting setup for a WPF app can be found here.

Device not receiving C# Windows Push Notifications because channel url incompatible

After many hours of trial, I still fail to send push notifications to my app. This is what I did so far:
Activate the service at https://appdev.microsoft.com
Got the SID, lets call it ms-app://s-1-23-4-12345678901-...-12345678901
Received the client secret, lets call it 12Lwq7526OqNY8iN-aLkwds23451345
In my app I implented the following at some point (simplified):
PushNotificationChannel channel = null;
channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
System.Diagnostics.Debug.WriteLine(channel.Uri);
This prints an url of that kind:
https://db3.notify.windows.com/?token=AgY7AABrfRCVgRV%2ba4DwoDjC2omrnOVwCkdhCrrzlJi6UpIwHzcig6%2fG5xZfnDqU0%2fXoE848ddiqyTaTlSSltp2Dn9Z3qaPsMAyh7kS%2bmlis1%2bwoh%2b%2b4DsAK1yeV1d9G1rUIuFs%3s
I added correct package name, publisher display name and publisher ID to my Package.appxmanifest file
So I thought I was ready for testing push notifications. Using my own implementation of push sharp, fiddler output is the following:
Request:
POST https://db3.notify.windows.com/?token=AgY7AABrfRCVgRV%2ba4DwoDjC2omrnOVwCkdhCrrzlJi6UpIwHzcig6%2fG5xZfnDqU0%2fXoE848ddiqyTaTlSSltp2Dn9Z3qaPsMAyh7kS%2bmlis1%2bwoh%2b%2b4DsAK1yeV1d9G1rUIuFs%3s HTTP/1.1
X-WNS-Type: wns/toast
Authorization: Bearer EgAC4AA1hAZAQMAklDAAEgAAAUe8/AGsK8a/yk78/WEDQf+KUld/nYIvJ51OIoCPgAfwqbl0oo1sPDLhd9ChiO/iLFVzwlTPE3trp9oTkJxNXi0yUrf+FKjRciq7Utek9B/4dxH9lFNy0R5iwdMS0xNS0yLTIyNDgyMDE1NzEtMjczODcxMjkyMy0yMzM3MbsS59ZuQmXCIAFoOiAAAAAAAgzMOTB7OuFIezrhS60gEAAoANS45LjYuMTBiPoPMh3Nj5MAEOp0RhrcMUx6D50AtDuzWE1AAAAAABeAG1zLWiwcDovL3MtTk2Nzk3LTEzOTYwNDkxODYtMjEyODYwMTQ3MS04MDg1MDg2ODUtMzY3NjQyNTk3OQA=
Content-Type: text/xml
Host: db3.notify.windows.com
Content-Length: 138
<toast>
<visual>
<binding template="ToastText01">
<text id="1">This is a test</text>
</binding>
</visual>
</toast>
Answer
HTTP/1.1 403 Forbidden
Content-Length: 0
X-WNS-ERROR-DESCRIPTION: Channel URL incompatible with caller app
X-WNS-MSG-ID: 5FC550364E079585
X-WNS-DEBUG-TRACE: DB3WNS4011533
Date: Mon, 23 Dec 2013 23:58:22 GMT
I found this post Channel URL incompatible with caller app so far which was not really helping
I get the same error using the web service of http://31daysofwindows8.com/push. What can I do here? What could have gone wrong? Please note that this app has not been published yet to the store and I am testing on my local Windows 8.1 installation.
Wow, this is unbelievable. I nearly went nuts, but here is the solution (and explanation):
In the windows app dashboard it says that you can set your app identity manually or automatically. I chose to do it manually (I mean, why not?). But that was a mistake. I quote from microsoft.com dashboard:
Set your app's identity values manually
Open your app's AppManifest.xml file in a text editor and set these attributes of the element using the values shown here.
<Identity Name=" MyName.MyApp " Publisher="CN=*******-****-****-****-************" />
This method did not let me receive push notifications!
The only way to get push notifications (for me) was the following: Try to set the app identity automatically by Visual Studio by calling this menu:
PROJECT -> STORE -> ASSOCIATE APP WITH THE STORE...
This solved my problem.
I was unable to use the "Associate App" approach because the customer wasn't comfortable with giving us their credentails.
What worked for me was to remove the following two elements from the .csproj file of the app:
<PackageCertificateKeyFile>...</PackageCertificateKeyFile>
<PackageCertificateThumbprint>...</PackageCertificateThumbprint>
Do that by either dragging the file into a text editor or unloading the project (using right click) and editing it using the xml editor (again in the context menu).
These elements might have snuck in when we associated our app with our testing app and stayed there when we removed the association and just set the identity as described by andreas.
<Identity Name="..." Publisher="CN=..." />
Edit: Just found out that doing this might break msbuild scripts that build packages. However, building app packages once within Visual Studio created new versions of these elements which then worked for me.
MS documents are a nightmare for me, finally I found what need to do is:
right click on your windows store app solution -> "Store" -> "Associate App with the Store..." -> choose your app name and follow the steps until message "successfully" -> rebuild and run
Despite edit manifest manually by strictly follow the documents, but apparently it's not complete enough.
Using Cordova for Windows, I found out, that even after "Associate App with the Store...", Push Messages failed to be delivered.
The issue was, that the App still had default CordovaApp_TemporaryKey.pfx assigned.
After I've copied new CordovaApp.Windows_StoreKey.pfx to CordovaApp_TemporaryKey.pfx message delivery succeed.

Disabling certificate revocation checking for an application on Windows

I have a .NET 3.5 desktop application that had been showing periodic slow downs in functionality whenever the test machine it was on was out of the office.
I managed to replicate the error on a machine in the office without an internet connection, but it was only when i used ANTS performance profiler that i got a clearer picture of what was going on.
In ANTS I saw a "Waiting for synchronization" taking up to 16 seconds that corresponded to the delay I could see in the application when NHibernate tried to load the System.Data.SqlServerCE.dll assembly.
If I tried the action again immediately it would work with no delay but if I left it for 5 minutes then it would be slow to load again the next time I tried it.
From my research so far it appears to be because the SqlServerCE dll is signed and so the system is trying to connect to get the certificate revocation lists and timing out.
Disabling the "Automatically detect settings" setting in the Internet Options LAN settings makes the problem go away, as does disabling the "Check for publishers certificate revocation".
But the admins where this application will be deployed are not going to be happy with the idea of disabling certificate checking on a per machine or per user basis so I really need to get the application level disabling of the CRL check working.
There is the well documented bug in .net 2.0 which describes this behaviour, and offers a possible fix with a config file element.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<generatePublisherEvidence enabled="false"/>
</runtime>
</configuration>
This is NOT working for me however even though I am using .net 3.5.
The SQLServerCE dll is being loaded dynamically by NHibernate and I wonder if the fact that it's dynamic could somehow be why the setting isn't working, but I don't know how I could check that.
Can anyone offer suggestions as to why the config setting might not work?
Or is there another way I could disable the check at the application level, perhaps a CAS policy setting that I can use to set an exception for the application when it's installed?
Or is there something I can change in the application to up the trust level or something like that?
You can specify in code if you want to check the revocation list per application:
ServicePointManager.CheckCertificateRevocationList = false;
In this blog posting (which cites another source) you have two options: disable CRL checking system wide or per app:
Disable CRL Checking Machine-Wide Control Panel -> Internet Options ->
Advanced -> Under security, uncheck the Check for publisher's
certificate revocation option
Disable CRL Checking For a Specific .Net Application See this
Microsoft KB Article: http://support.microsoft.com/kb/936707
What solved the problem for me:
I (think I) had a problem with online revocation before, so I explicitly switched to offline. Due to to warning, I now had to change...
_ = builder.Services.AddAuthentication(CertificateAuthenticationDefaults.AuthenticationScheme)
.AddCertificate(
options =>
{
options.AllowedCertificateTypes = CertificateTypes.All;
options.RevocationMode = X509RevocationMode.Offline;
}
);
... to ...
_ = builder.Services.AddAuthentication(CertificateAuthenticationDefaults.AuthenticationScheme)
.AddCertificate(
options =>
{
options.AllowedCertificateTypes = CertificateTypes.All;
options.RevocationMode = X509RevocationMode.NoCheck;
}
);

Categories

Resources