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

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.

Related

ExampleAssistantV1 with IBM Watson Unity SDK

I have attached the ExampleAssistantV1.cs script to a character in Unity and obtained my services credentials (API key and service URL) from the Assistant I have created.
From my dialog page, I can only see/get my Assistant Name and Assistant ID, but nothing like Workspace ID. I have searched around my bluemix pages and account details for the Assistant service, but cannot seem to find anything about Workspace. Where is this?
The version date when I used Tone Analyzer in Unity worked with the current date (yesterday) so I wonder if the same applies to Assistant? In the code comments, there is no explanation of what this date actually is...
When I run Unity, I get the following error. I could only find two threads on this; both are closed now on GitHub. Could someone please help me understand what I am missing?
[RESTConnector.ProcessRequestQueue()][ERROR] URL: https://gateway-lon.watsonplatform.net/assistant/api/v1/workspaces//message?version=2018-12-27, ErrorCode: 400, Error: 400 Bad Request, Response: {"error":"URL workspaceid parameter 'message' is not a valid GUID.","code":400}
After running in Unity, when I look at my service page, I see a new instance created with a unity-sdk-example-workspace-deleteUpdated message. How did I cause this? Have I done something wrong that this appears new?
If you click the three dots in the image above next to conversation assistant you can click View API Details. You should be able to see your Workspace ID there.
You supply the version date to select the version of the service you want to use in your application. You will be using the last service release on or before the version date supplied. If you use today's date you will be using the latest release of the service.
The issue with the the call is there is no workspaceId supplied. Ideally there should be a null check for this param. I've created an issue for this: https://github.com/watson-developer-cloud/unity-sdk/issues/490
As for the unity-sdk-example-workspace-deleteUpdated it look like you ran the AssistantV1 example. The example runs through each operation in the service and attempts to invoke it. In this case it looks like it failed to delete the workspace or the example was stopped before it was deleted. It is safe to delete this workspace/skill.

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.

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.

Windows Azure In-Role Caching Exception issue

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 :)

cannot generate early bound types CRM 2013 online

In order to follow this tutorial (http://msdn.microsoft.com/en-us/library/gg695790.aspx) I need to generate some early bound types. I cannot get the tool to work.
I've downloaded the latest CRM 2013 SDK
I've got a CRM2013 online trial account.
the URL I use is the one I got from the CRM2013->Settings->Customizations->Developer recources->organisation service.
the credential i use the default user (admin) from the CRM2013 online trial.
lets say it's John360
So the URL for CRM is like https://john360.crm4.dynamics.com/
user: john#john360.onmicrosoft.com
pwd: pass
organisationService: https://john360.api.crm4.dynamics.com/XRMServices/2011/Organization.svc
when I try the command like:
CrmSvcUtil.exe /codeCustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration" /out:Xrm\Xrm.cs /url:https://john360.api.crm4.dynamics.com/XRMServices/2011/Organization.svc /username:john /domain:john360.onmicrosoft.com /password:pass /namespace:Xrm /serviceContextName:XrmServiceContext
i get
value cannot be null. Parameter name: identityProvider
I also tried some Obvious other with or without quotes, with the 'domain' appended to the username, nothing works. I added the program to the firewall.
I also tried this tool https://xrmearlyboundgenerator.codeplex.com/
It also has problems connecting to the server. I tried with the latest version and with these connection settings: use CRM online and selected the crm4.dynamics.com
Login: john#john360.onmicrosoft.com, password: pass.
If I select 'Get Orgs.' I get the error
'an unsecured or incorrectly secured fault was received from the other party'
I've now also tried this route: http://code.msdn.microsoft.com/SdkSoapjs-Entity-Class-14ca830f
The program gives the same error as the other generator.
edit:
I actually got a bit further... with this command:
CrmSvcUtil.exe /codeCustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration" /out:Xrm.cs /url:"https://john360.api.crm4.dynamics.com/XRMServices/2011/Organization.svc" /username:"john#john360.onmicrosoft.com" /password:"pass" /namespace:Xrm /serviceContextName:XrmServiceContext /serviceContextPrefix:
it resultet in error:
Metadata contains a reference that cannot be resolved.
I didn't do any customization changes to my trail, so I'm not sure what this is about. Any suggestions are welcome.
Using the XrmToolBox as a method of connecting to CRM, I've created a GUI front end wrapper over the CrmSvcUtil.exe. It adds a lot of additional features, but most importantly for you, it creates the commandline required to generate the entities for you. Download it from the plugin store within the Xrm Tool Box, and never have this problem again!

Categories

Resources