microsoft / BikeSharing360_BackendServices

BikeSharing360 Demo Apps Backend Services
90 stars 50 forks source link

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable #1

Closed jerinjohnk closed 7 years ago

jerinjohnk commented 7 years ago

Deployed BikeSharing.Services.Deploy added the respective url to Main project public const string AuthenticationEndpoint = "http://bikesharing-services-profiles-----.azurewebsites.net/" but during login the new url http://bikesharing-services-profiles-----.azurewebsites.net/api/login it creates pops the error that resource is unavailable Could you help me out as to what I am missing?

eiximenis commented 7 years ago

Hi @jerinjohnk Ensure that authentication service is deployed. Go to http://xxxxx.azurewebsites.net/swagger/ui (where xxxxx is the name where of the serviceapp where xxxxx is deployed. If this URL do not respond, some error happened during the deployment.

How do you deployed the project? Using Visual Studio or using the "deploy to azure" button from the repo?

jerinjohnk commented 7 years ago

Yes @eiximenis even the new link isnt working. I am using Visual Studio 2015. I opened BikeSharing.Services.Deploy.sln which showed an loading error for Rides project and a Link. I intsalled .NET Core 1.0.1 SDK 1.0.0-preview2-003131 before deploying but still BikeSharing.Services.Rides project remained incompatbile. Deployed it again just now to find error

17:10:02 - Warning: Skipping source contentPathLib (D:\New folder (7)\BikeSharing360_BackendServices-master1\BikeSharing360_BackendServices-master\src\BikeSharing.Services.Deploy\bin\Debug\staging\BikeSharing.Services.Deploy\pubs\rides\approot) because of rule SkipInvalidSource.
17:10:02 - Could not find file 'D:\New folder (7)\BikeSharing360_BackendServices-master1\BikeSharing360_BackendServices-master\src\BikeSharing.Services.Deploy\bin\Debug\staging\BikeSharing.Services.Deploy\pubs\rides\approot'.  Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#FileOrFolderNotFound.
17:10:02 - Total changes: 0 (0 added, 0 deleted, 0 updated, 0 parameters changed, 0 bytes copied)
17:10:02 - 
17:10:02 - 
17:10:02 - 
17:10:04 - Deploying template using PowerShell script failed.

How Can I fix this without upgrading to VS 2017RC1

eiximenis commented 7 years ago

Hi. SDK used is 1.0.0-preview2-003121 (which is referred in the global.json file). This SDK is supposed to be .NET Core 1.0

For the rides project this is a NodeJS project, so you need the NodeJS Tools for Visual Studio (https://www.visualstudio.com/vs/node-js/) installed to be able to load it.

jerinjohnk commented 7 years ago

Yes adding the exact version 1.0.0-preview2-003121 and node.js helped and am able to open /swagger/ui . Though it did popup an error 18:25:37 - Info: Using ID '23bb843e-a220-4774-9c80-ea0f013022eb' for connections to the remote server.

18:25:37 - Warning: Skipping source contentPathLib (D:\New folder (7)\BikeSharing360_BackendServices-master1\BikeSharing360_BackendServices-master\src\BikeSharing.Services.Deploy\bin\Debug\staging\BikeSharing.Services.Deploy\pubs\rides\approot) because of rule SkipInvalidSource.
18:25:37 - Could not find file 'D:\New folder (7)\BikeSharing360_BackendServices-master1\BikeSharing360_BackendServices-master\src\BikeSharing.Services.Deploy\bin\Debug\staging\BikeSharing.Services.Deploy\pubs\rides\approot'.  Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#FileOrFolderNotFound.

So after opening up swagger/UI. I tried deploying main app. But during sign up its throwing 500 error. So tried using swagger/UI Post /api/Profiles

{
  "userName": "j",
  "password": "j",
  "gender": "m",
  "birthDate": "1989-12-15T12:39:18.857Z",
  "firstName": "j",
  "lastName": "j",
  "email": "j@gmail.com",
  "tenantId": 1,
  "skype": "j"
}

And Put /api/Profiles

{
  "id": 0,
  "userId": 0,
  "user": {
    "id": 0,
    "userName": "jerin",
    "lastLogin": "2016-12-15T12:39:18.862Z",
    "profile": {},
    "password": "a",
    "subscriptions": [
      {
        "id": 0,
        "type": "None",
        "expiresOn": "2017-12-15T12:39:18.863Z",
        "status": "Valid",
        "userId": 0,
        "user": {}
      }
    ],
    "tenantId": 1,
    "tenant": {
      "id": 0,
      "name": "j",
      "users": [
        {}
      ]
    }
  },
  "gender": "NotSpecified",
  "birthDate": "2016-12-15T12:39:18.863Z",
  "firstName": "j",
  "lastName": "j",
  "email": "j@j.com",
  "payment": {
    "id": 0,
    "creditCard": "j",
    "creditCardType": "None",
    "expirationDate": "2016-12-15T12:39:18.863Z"
  },
  "paymentId": 0,
  "faceProfileId": "string",
  "voiceProfileId": "string",
  "voiceSecretPhrase": "string",
  "skype": "j",
  "mobile": "string",
  "photoUrl": "string"
}

Both return 500 error.

eiximenis commented 7 years ago

At least you have the code deployed succesfully. :)

The call that the Xamarin App uses to create a User is POST /api/profiles. This creates both a User and its associated Profile:

{ "userName": "eiximenis", "password": "Bikes360", "gender": "Male", "birthDate": "2017-12-15T14:19:12.202Z", "firstName": "Eduard", "lastName": "Tomas", "email": "eiximenis@xxxx.com", "tenantId": 1, "skype": "eiximenis" }

You MUST have a valid tenant in the database. I am assuming that you have NOT run the sql/profiles-data.sql against the profiles database. If this is the case you don't have any valid tenant. Need to create one manually using following SQL script:

SET IDENTITY_INSERT [dbo].[Tenants] ON 
GO
INSERT [dbo].[Tenants] ([Id], [Name]) VALUES (1, N'New York')
GO
SET IDENTITY_INSERT [dbo].[Tenants] OFF
GO

This will add the tenantId 1, and this is the value of tenantId you must use in POST /api/Profiles (if you run the sql script you already have this tenant inserted, so in this case using tenantId of 1 should work).

jerinjohnk commented 7 years ago

Success. I am able to login. Thanks a lot @eiximenis for being patient with me and answering my queries. Steps Followed for Noob like me 1) Install 1.0.0-preview2-003121 and node.js 2) After it completes installation went to BikeSharing360_BackendServices-master\src\BikeSharing.Services.Profiles.Database\dbo\Tables and ran all queries then only databases were created. 3) Now I ran the above query to create a new Tenant and used POST /api/profiles to create a new user and Voila I am able to login now.