I have an IOS app (Objective C), which uses Sashido.io implementation of Parse, which works perfectly. Now I want to develop an Android app, which should connect to the same ParseServer.
Since I am familiar with C# and Visual Studio (Mac version) is my second home, I thought that Xamarin was the way to go - but I might be wrong;
For the last couple of days, I have been struggling to get any Xamarin multiplatform projects to connect to my parse server.
I have tried the SharedLibrary approach (.NET Standard2) with the Parse.NETStandard2 (v2.0.0) Nuget-package, but I had no luck with that, it crashes every time I would try to do anything Parse-releated - stack trace hinting some library is missing, but I am unable to locate the missing link.
I have now tried the Multiplatform-library with the Parse (v1.7.0) nuget-package as well, but with no grether luck;
The following code crashes with Parse-authorization error.
I have double/tripled checked both the ApplicationId and the Server-url.
ParseClient.Initialize(new ParseClient.Configuration
{
ApplicationId = "Xxxxxxxxxxxxxxxx",
WindowsKey = "undefined",
Server = "https://pg-app-xxxxxxxxxxxxxx.scalabl.cloud/1/"
});
try
{
ParseUser currentUser = ParseUser.LogInAsync("realusername", "realpassword").Result;
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(String.Format("EXCEPTION: {0}", ex.Message));
}
I have googled everything remotely related to my issue, but I haven't found any newer blogs or tutorials - letting me to believe that either, it is normally not an issue or that Xamarin and parse-server simply is a no go.
I would appreciate any pointers in the right direction for getting an Xamarin-app to connect to Parse.
I am not too familiar with the multiplatform environment.
Related
Problem Details
I have a Blazor project with a simple Database-CRUD (create, read, update, delete) example. It works properly when I run it within Visual Studio but if I publish it the program runs into an error.
Project Details
IDE is Visual Studio 2019. Project is Blazor Webassembly. I tried .NET CORE 3.1 and .NET 5.0. Database is SQL Server 2019. IIS for publishing.
Code Details
Database access is working with mapping (Scaffold-DbContext). I use the nuggets “Microsoft.EntityFrameworkCore.Tools” and “Microsoft.EntityFrameworkCore.SqlServer”.
This is the read command:
using var httpResponse = await Http.GetAsync("/api/DataLrs/Index");
This is the read command-snippet I use for more error details:
using var httpResponse = await Http.GetAsync("/api/DataLrs/Index");
if (!httpResponse.IsSuccessStatusCode)
{
// set error message for display, log to console and return
errorMessage = httpResponse.ReasonPhrase;
Console.WriteLine($"There was an error! {errorMessage}");
return;
}
// convert http response data to UsersResponse object
dataLrsList = await httpResponse.Content.ReadFromJsonAsync<DataLrs[]>();
Error Details
When I publish the project with IIS and try to execute the same commands I get the following error in the browser:
Internal Server Error
System.Net.Http.HttpRequestException: net_http_message_not_success_statuscode, 500
Solution Attempts Details
As already mentioned, when I run it in Visual Studio it works without any problems. I already googled and tried several stuff but nothing really works.
How can I get a better error description?
Is anybody familiar with this problem?
I realized many people have the same/similar problem, but I couldn’t find a clear solution
Thanks!
Yes, you are right, I am using EF Core. Sorry! Forgot to mention that important detail.
Database Details
To make it not too complicated I am using a database on my pc and I am also publishing (IIS) on my pc. If all works, I would proceed with a server.
I retrieved my connection string via Visual Studio’s SQLServerObjectExplorer. I use for both modes (debug, publish) the same connection string which is stored in appsettings.json.
This is the connection string:
Data Source=CND823509T\SQLEXPRESS;Initial Catalog=DataComposerWebDBTest;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False
Method Details
Here are some of my method details, I will just copy the important lines (hope that is enough). I got the structure from a general example I googled. As already mentioned, locally it works.
RazorePage.razor
dataLrsList = await Http.GetFromJsonAsync<DataLrs[]>("/api/DataLrs/Index")
DataLrsAccessLayer.cs
public IEnumerable<DataLrs> GetData()
{
try
{
return _context.DataLrs.ToList();
}
catch (Exception ex)
{
throw;
}
}
DataLrsController.cs
[HttpGet]
[Route("api/DataLrs/Index")]
public IEnumerable<DataLrs> Index()
{
return _dataLrs.GetData();
}
Questions Details
Do you need more details?
What do you mean with localDB stuff?
Thanks!
I've been looking and looking all over to what is the reason why my server doesn't start. I got the C# WinForms version from here, This is the snippet, working fine at my end, it starts the server using localhost and my local ip address.
try
{
SignalR = WebApp.Start(ServerURI);
}
catch (TargetInvocationException ex)
{
WriteToConsole("Server failed to start because " + ex.Message);
//Re-enable button to let user try to start server again
this.Invoke((Action)(() => ButtonStart.Enabled = true));
return;
}
this.Invoke((Action)(() => ButtonStop.Enabled = true));
WriteToConsole("Server started at " + ServerURI);
but for some reason, on some laptops and computers, it doesn't work. It does not start the server and doesn't catch the error too. So I don't know what's causing the problem.
I built the release version, copied the release folder to another PC to test, and its working fine, you just have to run as admin
Then I copied to the pc who is supposed to use the server app, it doesn't start.
I already installed .Net 4.5.2 and 4.6 which is the supposed to be requirement, its still not working. I don't know what I am missing. Is there anything that I need to install?
I was stuck with the same problem while making my server client interaction to start, spent almost 3 hours battling my way through the Dlls and configurations. It seems like SignalR requires a few Dlls that you would need to add externally.
SignalrR
SignalR.Hubs
SignalR.Hosting.Common
Microsoft.Owin.Host.HttpListener
One good sample project that helped me solve a lot of problem was this https://code.msdn.microsoft.com/windowsdesktop/Using-SignalR-in-WinForms-f1ec847b
If you still face issues, comment with the error message you get and I might be able to help further.
I am experimenting with Project Rome and I am facing some issue with finding my Xbox console.
I can find my tablet, another laptop but I cannot find my Xbox console - it is a developer kit. I also tried to switch it to retail console but no difference.
private RemoteSystemWatcher remoteSystemWatcher;
remoteSystemWatcher = RemoteSystem.CreateWatcher();
remoteSystemWatcher.RemoteSystemAdded += OnDeviceAdded;
remoteSystemWatcher.Start();
private void OnDeviceAdded(RemoteSystemWatcher sender, RemoteSystemAddedEventArgs args)
{
}
I also tried to find Xbox console via HostName or IP, unfortunately it raises exception. Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)). It seems like the same issue with this method as described here.
await RemoteSystem.FindByHostNameAsync(new HostName("...."));
It seems like a problem with specific version (10.0.14393.2113) of OS which I had installed before.
Right now I installed following version and it works without any problems.
Xbox One Recovery Update [14393.2152.161208-1218] December 14, 2016
Even this works if I use IP address of my Xbox console (with hostname it does not work).
await RemoteSystem.FindByHostNameAsync(new HostName("...."));
I'm playing around with remote UWP AppServices in C# and I run into a very early roadblock: Getting a RemoteSystem instance.
I followed the tutorial on https://msdn.microsoft.com/en-us/windows/uwp/launch-resume/communicate-with-a-remote-app-service with my own code and I tried out the RemoteSystems sample as part of https://github.com/Microsoft/Windows-universal-samples
Unfortunately, the result is always the same.
First I request access to remote systems:
RemoteSystemAccessStatus status = await RemoteSystem.RequestAccessAsync();
This is successful: status has the value RemoteSystemAccessStatus.Allowed.
Next, I create a HostName instance:
var deviceHost = new HostName("computer2");
Then I want to get a RemoteSystem instance:
RemoteSystem remoteSystem = await RemoteSystem.FindByHostNameAsync(deviceHost);
This throws an exception:
Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
What I tried
Searching the web doesn't bring up much at this time (remote UWP AppServices are too new)
The event log doesn't have anything interesting in it
The Windows firewall seems to be configured correctly (this seems to be done automatically by Visual Studio)
What I'm looking for
One of my computer was upgraded from Windows 7 to Windows 10, the other from Windows 8.1 to Windows 10. So there is a chance my computers are "misconfigured" in some way (I remember the unnecessary task scheduler entries for Windows Media Center...)
My question: What are recommended practices to troubleshoot these kinds of problems? Are there tools that can help me? Right now I'm now even sure where to start looking...
I'm having problems with the Storage emulator after upgrading my Microsoft.WindowsAzure.Storage library to version 4.0.1.
The following code:
var client = CloudStorageAccount.Parse(connectionString).CreateCloudTableClient();
var table = client.GetTableReference("TableName");
table.CreateIfNotExists();
The call to table.CreateIfNotExists() throws a StorageException, with detail:
Message: The remote server returned an error: (400) Bad Request.
InnerException.Response: The value for one of the HTTP headers is not
in the correct format.
I am aware of the previous issue with using the 3.x client libraries with version 2.0 of the emulator (or something along those lines) and was able to work around it.
Connecting to real table service works fine, so it's something to do with the emulator.
Any ideas?
Edit: for those looking, the direct download link for the 3.2 version of the emulator is here - http://download.microsoft.com/download/0/F/1/0F162192-CDE5-413D-8DC0-37F41300B47B/WindowsAzureStorageEmulator.msi
My advice for troubleshooting emulator problems is to first make sure you have the latest version of the emulator installed. A 400 response often means you have a newer version of the client libraries and are attempting to perform an operation not yet implemented in your version of the emulator.
For more information on the latest version see here.
Jason
I was stumped by the same problem for several hours. I had Azure SDK 2.3 configured against my solution and was running the old v1.7 StorageClient - worth noting is that everything worked find but I needed to upgrade the storage library to use some new features. Anyway after removing the v1.7 StorageClient and doing a NuGet on the new storage library I found I had this error. In the end I tried everything:
Double-checked names of my queues
Manually checked every bin/obj folder for the storage client assembly and removed any left lying around
Rebooted - because I was getting desperate
In the end I just reinstalled the v2.3 Azure SDK and it fixed it. No errors came up when I reinstalled, it just worked as expected.
So if in doubt do try an SDK reinstall.
A 400 error in itself doesn't tell you much. Grab the exceptions RequestInformation.HttpStatusCode, RequestInformation.ExtendedErrorInformation.ErrorCode and RequestInformation.ExtendedErrorInformation.ErrorMessage, this will help you see more detail (code sample below).
Before making calls to the emulator also make sure you're aware of the various naming constraints (such as forbidden characters in partition keys, table names, etc), the data types supported (dates must be UTC, decimals aren't supported, etc) and finally the differences between what the emulator and Azure support, as there are a couple.
try
{
// do something
}
catch (StorageException ex)
{
ApplicationException aex = new ApplicationException("StorageException in SaveTransactionsToAzure()", ex);
aex.Source = "SaveTransactionsToAzure()";
aex.Data.Add("HttpStatusCode", ex.RequestInformation.HttpStatusCode);
aex.Data.Add("ErrorCode", ex.RequestInformation.ExtendedErrorInformation.ErrorCode);
aex.Data.Add("ErrorMessage", ex.RequestInformation.ExtendedErrorInformation.ErrorMessage);
throw aex;
}