Closed marcuskeenan closed 8 years ago
Make sure you use the right format for the host name (no http:// at the beginning, no slash at the end). Also please can you give more details about the failure? Do you use your own IoTHub and Azure Mobile App Service? Have you tried debugging it? What is the line that fails?
here's the format: DefaultHostName = "mydriving-xxxxxxxxxxx.azure-devices.net";
I used my own IoTHub and App service. I haven't run any debugging. The app runs ok on the iPhone but the device is not registering with the IoTHub.
@sigwaveLabs did you provisioning of whole solution? you need at least:
and in Logger.cs setup correct id for HockeyApp to collect crashes
Yes, I ran the azure powershell script, authorized only fb, added the HockeyApp ID to the Logger.cs The only part I didn't setup was VSTS.
try to use Device Explorer to see if your device is registered in IoT Hub https://github.com/Azure/azure-iot-sdks/blob/master/tools/DeviceExplorer/doc/how_to_use_device_explorer.md and look into Devices table if there is your device best solution is to debug your app .. you can do it localy on your computer if you have WIN10 - change platform to x86/64 and target Local Machine in your visual studio and setup UWP app as startup project - MyDriving.UWP or try tu debug it on iPhone
@sigwaveLabs I assume you also use your own sql database.
Could you check table UserProfiles in mydrivingdb?
Is your user registered successfully?
Yes, the db was created via the script, the UserProfile shows that I successfully register with fb.
Here's what I found from debug: [0:] Unable to provision device with IOT Hub: Cannot cast Newtonsoft.Json.Linq.JArray to Newtonsoft.Json.Linq.JToken.2016-05-04 01:36:56.149 MyDrivingiOS[32562:405886] Unable to provision device with IOT Hub: Cannot cast Newtonsoft.Json.Linq.JArray to Newtonsoft.Json.Linq.JToken.
I then updated Newtonsoft.Json to v8.0.3
Now debug shows:
2016-05-04 02:06:30.434 MyDrivingiOS[34136:428746] Unable to provision device with IOT Hub: Value cannot be null. Parameter name: token[0:] Unable to provision device with IOT Hub: Value cannot be null. Parameter name: token
it means that mobile app (my driving service) don't return SAS for device you can try to debug it remotely against azure (I assume that you published service to mobile app, because your user is regsitererd and can login) you don't need to change web.config, all necessary values should be set-up at azure web settings level
@sigwaveLabs Did you set IoTHubConnectionString in your app service?
You need to add a config setting "IoTHubConnectionString" in App service (mydriving-sth) -> all settings -> application settings -> App settings
You can get the string value from Azure IoT Hub (mydriving-sth) -> all settings -> shared access policies -> iothubowner -> connection string - primary key
@xiangyan99 The connection string looks good in the App service settings as well.
Also, I want to note that I ran the same app on my device connected to the sandbox and that seemed to work.
From the AppService Dubug:
w3wp.exe Warning: 0 : Message='UserMessage='No HTTP resource was found that matches the request URI 'https://mydriving-xxxxxxxxxxx.azurewebsites.net/tables/POI?$filter=(updatedAt ge datetimeoffset'1970-01-01T00:00:00.0000000%2B00:00')&$orderby=updatedAt&$skip=0&$top=50&__includeDeleted=true'.'', Operation=ApiControllerActionSelector.SelectAction, Status=404 (NotFound), Exception=System.Web.Http.HttpResponseException: Processing of the HTTP request resulted in an exception. Please see the HTTP response returned by the 'Response' property of this exception for details. at System.Web.Http.Controllers.ApiControllerActionSelector.ActionSelectorCacheItem.SelectAction(HttpControllerContext controllerContext) at System.Web.Http.Controllers.ApiControllerActionSelector.SelectAction(HttpControllerContext controllerContext) at System.Web.Http.Tracing.Tracers.HttpActionSelectorTracer.<>c__DisplayClass2.<System.Web.Http.Controllers.IHttpActionSelector.SelectAction>b__0() at System.Web.Http.Tracing.ITraceWriterExtensions.TraceBeginEnd(ITraceWriter traceWriter, HttpRequestMessage request, String category, TraceLevel level, String operatorName, String operationName, Action
1 beginTrace, Action execute, Action1 endTrace, Action
1 errorTrace)
w3wp.exe Warning: 0 : Message='UserMessage='No HTTP resource was found that matches the request URI 'https://mydriving-xxxxxxxxxxx.azurewebsites.net/tables/POI?$filter=(updatedAt ge datetimeoffset'1970-01-01T00:00:00.0000000%2B00:00')&$orderby=updatedAt&$skip=0&$top=50&includeDeleted=true'.'', Operation=POIController.ExecuteAsync, Status=404 (NotFound), Exception=System.Web.Http.HttpResponseException: Processing of the HTTP request resulted in an exception. Please see the HTTP response returned by the 'Response' property of this exception for details.
at System.Web.Http.Controllers.ApiControllerActionSelector.ActionSelectorCacheItem.SelectAction(HttpControllerContext controllerContext)
at System.Web.Http.Controllers.ApiControllerActionSelector.SelectAction(HttpControllerContext controllerContext)
at System.Web.Http.Tracing.Tracers.HttpActionSelectorTracer.<>cDisplayClass2.1 beginTrace, Action execute, Action
1 endTrace, Action`1 errorTrace)
at System.Web.Http.Tracing.Tracers.HttpActionSelectorTracer.System.Web.Http.Controllers.IHttpActionSelector.SelectAction(HttpControllerContext controllerContext)
at System.Web.Http.ApiController.ExecuteAsync(HttpControllerContext controllerContext, CancellationToken cancellationToken)
at System.Web.Http.Tracing.Tracers.HttpControllerTracer.
@sigwaveLabs Did you change the code under src\MobileAppService\MyDrivingService\Controllers\POIController.cs?
And could you check if POIs table exists in your database mydrivingDB?
@xiangyan99 No code changes, using the stock service created by the script. The POIs table exists, no data in the table.
are you really using mydriving-xxxxxxxxxxx.azurewebsites.net or real address you can find in blade for mobile app at azure portal?
This is not the real address. I just rebuilt the entire solution from a fresh clone, deployed the app and still have the same problem. I suspect I may be missing and important step. I get errors on the rebuild for the iOS app and need to update packages for the build. The only code I changed are the AzureVlient web address, the IoTHub name into the DeviceProvision profile and the hockey app is for iOS in the logger.
did you publish MyDrivingService from visual studio to mobile app in azure? I have no more ideas, try to remote debug MyDrivingService and try to debug your app in mobile
It was published using the script. I'll see if I can update and publish just the service,nadler some debugging. I'll let you know what I find. Thanks:)
--> It was published using the script.
Did you rebuild it and re-publish it?
You need to rebuild the project and publish the new binaries to make the new IoThub string work.
@xiangyan99 ok, i'll try that. Do I need to just download the publish settings? Do I need to change anything in the web.conf?
as I mentioned earlier you don't need to change it in web.config, portal settings override it and you have it correctly as you wrote as reply to commet of @xiangyan99
but only to be sure:
You need to have config setting "IoTHubConnectionString" in App service (mydriving-xxxxx) -> all settings -> application settings -> App settings
You can get the string value from Azure IoT Hub (mydriving-xxxxx) -> all settings -> shared access policies -> iothubowner -> connection string - primary key
@sigwaveLabs is it working for you?
@sigwaveLabs the mobile application caches the hostname and the DeviceConnectionString in Settings; if you change the hostname make sure you uninstall the old application from the device. Some suggestions for debugging:
@sigwaveLabs please reopen, if your problem perisists
can i ask about connection Mobile app service with Mobile app and what is configuration i should to do it by steps ? i looked at documentation on azure but i still stuck in connection and db still emty
Not sure why the IoS app will not connect to the IoTHub. I entered the IoTHub name in the DeviceProvisionHandler and still no conection.