I'm experiencing a strange behavior. Got a Custom Vision service deployed on Azure. It contains a single project with no published models.
Using the HTTP REST Api and querying for projects, it correctly returns a list of (one) projects as shown below:
GET https://westeurope.api.cognitive.microsoft.com/customvision/v3.0/training/projects HTTP/1.1
Host: westeurope.api.cognitive.microsoft.com
Training-Key: {MY_TRAINING_APIKEY}
apim-request-id: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
Date: Thu, 02 May 2019 18:57:25 GMT
Content-Length: 605
Content-Type: application/json; charset=utf-8
[{
PROJECT_DATA
}]
But, if I try to use the service via C# SDK using:
Microsoft.Azure.CognitiveServices.Vision.CustomVision.Prediction
Microsoft.Azure.CognitiveServices.Vision.CustomVision.Training
both 1.0 version, every time I got:
Microsoft.Azure.CognitiveServices.Vision.CustomVision.Training.Models.CustomVisionErrorException:
'Operation returned an invalid status code 'NotFound''
This is the code snippet using the SDK.
using (CustomVisionTrainingClient client = new CustomVisionTrainingClient())
{
client.ApiKey = "{MY_TRAINING_APIKEY}";
client.Endpoint = "https://westeurope.api.cognitive.microsoft.com/customvision/v3.0/Training/";
var projects = client.GetProjects();
}
Interesting fact: trying to use both Training and Prediction clients on currently working Custom Vision project (with deployed models too) I keep getting NotFound error on every SDK method.
Am I missing something?
Thanks in advance.
Fabio.
For CognitiveServices Vision clients, you need to provide the base URI as the Endpoint property, not the entire API endpoint. The client SDK itself will add the remainder of the path (including the version) depending on the method you call.
So in your case you need to do the following:
using (CustomVisionTrainingClient client = new CustomVisionTrainingClient())
{
client.ApiKey = "{MY_TRAINING_APIKEY}";
client.Endpoint = "https://westeurope.api.cognitive.microsoft.com";
var projects = client.GetProjects();
}
Related
I'm using SignalR for communication between my backend server and winform client.
Well I tried to start the hub connection between those 2 but I got error from the client.
It throw exception 405 Method is not allowed.
It said:
{
StatusCode: 405,
ReasonPhrase: 'Method Not Allowed',
Version: 1.1,
Content: System.Net.Http.StreamContent,
Headers: \r\ n {
\
r\ n Date: Tue, 27 Dec 2022 06: 42: 18 GMT\ r\ n Server: Kestrel\ r\ n Content - Length: 0\ r\ n Content - Type: text / plain\ r\ n
}
}
It did some research about this error and tried everything from enable Cors, add useSignalr... which I'm already did. Anyone having the same issue?
About the package: I'm using Microsoft.AspNet.SignalR.Core 2.4.3 on Server, Microsoft.AspNet.SignalR.Client 2.4.3 on Client.
This is my Service try the hubconnection:
My Service with the hub connection
405 Code
I tried to enable Cors, using the same version on server and client for SignalR, use differ packages.
I was excepting that it will hit my Hub on my server but no.
I authored the link Jason referenced and I think that link does apply if you are trying to run .NET 4.x (client/server) with .NET CORE 6 (client/server). They don't mix and cannot be used together.
However, from your scenario it looks like you are running - "Microsoft.AspNet.SignalR.Core 2.4.3 on Server" and "Microsoft.AspNet.SignalR.Client 2.4.3"
Which are fine for a .NET 4.7/8 server. 1 issue I see here is "Content: System.Net.Http.StreamContent," will not work because this version does not support streaming (.NET CORE 6/7 does).
Your overall problem may be resolved by checking to see if you can or have .NET 4.7/8 on your server. According to this you should be able to have both but everything will still run in IIS (meaning .NET CORE 6/7 apps must as well in their own app pool).
Hopefully one of these help you resolve your issue.
When using ASP.Net Core's authentication for Google, I'm performing the following scenario:
Click to login via Google.
Log into Google successfully. At this point I am returned back to my application and I am able to move on my with process. The user claims were returned as expected.
Immediately go back to step 1 and try to login via Google again with the same account. If prompted at Google, select the same account/enter the credentials again.
At this point I now receive the below error.
If I wait a period of time, perhaps 30 minutes, if I start at step 1 again, I don't encounter the issue until I again reach step 4. If I restart my IIS ApplicationPool for my Core project, I can follow the above scenario where step 1 works, but then step 4 shows the issue.
I have searched what feels like endlessly online to no avail. Does anyone have anything they can suggest? Why would this work the first time, and then fail on second, third attempts?
I'm receiving the below error when following the scenario above on my Google Pixel 3 XL phone:
System.Exception:
SocialLoginController|Error|OAuth
token endpoint failure: Status: BadRequest;Headers: Vary: X-Origin,
Referer, Origin,Accept-Encoding Date: Sun, 03 Mar 2019 09:35:45 GMT
Server: ESF Cache-Control: private X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN X-Content-Type-Options: nosniff
Alt-Svc: quic=":443"; ma=2592000; v="44,43,39" Accept-Ranges: none
Transfer-Encoding: chunked ;Body: { "error": "invalid_grant",
"error_description": "Bad Request" };
The code in my Startup.cs class for Google's authentication is as follows:
services.AddAuthentication(options =>
{
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
})
.AddCookie(options =>
{
options.LoginPath = "/login";
options.LogoutPath = "/signout";
});
services.AddAuthentication().AddGoogle(socialProvider.ProviderName, o =>
{
o.ClientId = [REMOVED]
o.ClientSecret = [REMOVED]
o.UserInformationEndpoint = "https://www.googleapis.com/oauth2/v2/userinfo";
o.ClaimActions.Clear();
o.ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "id");
o.ClaimActions.MapJsonKey(ClaimTypes.Name, "name");
o.ClaimActions.MapJsonKey(ClaimTypes.GivenName, "given_name");
o.ClaimActions.MapJsonKey(ClaimTypes.Surname, "family_name");
o.ClaimActions.MapJsonKey("urn:google:profile", "link");
o.ClaimActions.MapJsonKey(ClaimTypes.Email, "email");
o.CallbackPath = string.Format("/signin-{0}", socialProvider.ProviderName.ToLower());
o.SaveTokens = true;
o.Events.OnRemoteFailure = ctx =>
{
string message = UrlEncoder.Default.Encode(ctx.Failure.Message);
if (!string.IsNullOrEmpty(message) && message.Length > 1500)
{
message = message.Substring(0, 1499);
}
ctx.Response.Redirect(errorRedirectUrl + message);
ctx.HandleResponse();
return Task.FromResult(0);
};
});
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
Please also see the image below that shows the error when I have enabled "UseDeveloperExceptionPage".
FYI, I am completely unable to replicate the issue on my iPhone and my Desktop PC - I never receive the issue and I can make as many login attempts as I want, the issue never seems to arise on these devices.
I'm lost!
I was able to identify my issue here which turns out to be unique to any other answer I found with the same error I experienced above.
Issue: On my Pixel device, I have an application (My-App) that runs against the same domain that I was accessing in my Chrome browser. When clicking to login via Google, I remember it asked me if I wanted to 'Open in Chrome' or 'Open in My-App', and I always selected 'Open in Chrome'.
I uninstalled My-App, and now I am unable to replicate the issue. The issue is gone. I tried the scenario many times to no avail, every time it worked! When I re-installed My-App, the issue came back.
Fix: the problem that I need to resolve is running my Core project on a different domain other than the domain My-App is running, so there won't be a confusion on the device about whether Chrome should open or My-App should open. Hopefully that will be my fix!
Thanks for reading.
Hello i am getting an error when using Microsoft graph api, i am getting a 403 error when I am updating a planner task.
StatusCode:403,
ReasonPhrase:'Forbidden',
Version:1.1,
Content:System.Net.Http.StreamContent,
Headers:{
Transfer-Encoding: chunked request-id:7 c6e6c64-60e8-4d65-a248-c91841f8f8ca client-request-id:7 c6e6c64-60e8-4d65-a248-c91841f8f8ca x-ms-ags-diagnostic:{
"ServerInfo":{
"DataCenter":"North Europe",
"Slice":"SliceC",
"Ring":"3",
"ScaleUnit":"001",
"Host":"AGSFE_IN_70",
"ADSiteName":"NEU"
}
} Duration:184.823 Strict-Transport-Security: max-age=31536000 Cache-Control: private Date:Wed,
03 Oct 2018 06:24:41 GMT Content-Type:application/json
}
}
I have created my own plan to create tasks and assign them accordingly. This application used to work without any issue but suddenly it started throwing this issue.
This issue only occurs on the update, other functions like the read, create and delete work without any issue.
I have full office 365 admin rights, so it is not admin related issues. I have looked at the Graph Api on Git Hub to see possible causes of this problem. In the git hub it states if a particular code is shown it can be referenced to the cause of the problem but there is no code provided
Planner Api Documentation
Any help would be appreciated to solve this issue
This was solved through trial and error.
The problem with it was due to me trying to modify the PlanId which i found out cannot be modified on update.
Once the PlanId part was removed from the api post request it updated without any issue
End device: EMC ECS,
Protocol: AWS S3
I'm trying to authenticate with my Python script and construct the same request using Paw.
Python with boto works just fine.
The primitive code:
from boto.s3.connection import S3Connection
accessKeyId = 'objuser'
secretKey = 'spl4vDHl11H7uW/683WZCoYrle03Bn1hd42gy8bd'
host = '10.10.10.10'
port = 9020
conn = S3Connection(aws_access_key_id=accessKeyId,
aws_secret_access_key=secretKey,
host=host,
port=port,
calling_format='boto.s3.connection.ProtocolIndependentOrdinaryCallingFormat',
is_secure=False)
print conn.get_all_buckets()
Correct headers are accepted by the S3 server
Date: Fri, 08 Apr 2016 07:38:34 GMT
Authorisation: AWS obtuser:Gi/qcdbyYcVMdI9EkdORPMx2wbo=
Next I re-create the same request with Paw but get wrong headers:
Date: Fri, 08 Apr 2016 07:38:34 GMT
Authorisation: AWS obtuser:/znFNFviqD5fw3t1oWUwBQ8B5M4=
Of course it is rejected by the S3 server.
In Paw I use Authorisation header with standard "S3 Amazon S3 Authorisation Header" dynamic value. AWS Access Key ID and Secret Access key ID are the same as in the script (triple checked).
According to the ECS documentation, S3 Authentication follows Signing and Authenticating REST Requests So signature is based on the standard HMAC-SHA1.
I expect that the same method is used by Paw.
Could you please advice what is potential reason why Paw doesn't create correct Authorisation header and how to fix that?
Many thanks in advance !
Sorry for the very late answer! I've just tested this again myself, using our AWS account, and for example, I've been able to list all our S3 buckets easily, see this screenshot:
It seems like it's probably an issue related to the way the Authorization header has been configured, or an invalid character being inserted in the URL field. (A screenshot would help to see what can be wrong)
Using Paw v3.0.16 and "Amazon S3 Authorisation Header" dynamic value, SignatureDoesNotMatch error occurred with this URL.
GET https://s3-ap-northeast-1.amazonaws.com/bucket123/sub456/some789.json
And it works well with this URL.
GET https://bucket123.s3.amazonaws.com/sub456/some789.json
http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html
I have read emails from Exchange online in c#.net using Office 365 API, but getting some issue on response object
(HttpResponseMessage response = await client.SendAsync(request))
i.e
{StatusCode: 403, ReasonPhrase: 'Forbidden', Version: 1.1, Content:
System.Net.Http.StreamContent, Headers:
{
Transfer-Encoding: chunked
request-id: a0983ea5-313d-4234-b1c6-249f3359c71c
client-request-id: a0983ea5-313d-4234-b1c6-249f3359c71c
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"SouthEast
Asia","Slice":"SliceB","ScaleUnit":"002","Host":"AGSFE_IN_3","ADSiteName":"SIN"}
}
OutBoundDuration: 906.2963
Duration: 1177.9769
Cache-Control: private
Date: Wed, 23 Dec 2015 12:08:42 GMT
Server: Microsoft-IIS/8.5
X-Powered-By: ASP.NET
Content-Type: application/json
}}
For more information :
Please refer this link : http://dev.office.com/getting- started/office365apis
Provide required information login,app name etc.
Download app and run your system
In run time ,error occurred on response object
So Please tell me how to fixed it and let me know if any information required.
Please help me out.
Thanks,
Sheena
You have to register your application on Azure Active Directory (AAD) and set the application permissions to read emails in your app registration.
Check out this presentations starting fromr slide #24:
http://www.mostafaelzoghbi.com/2015/10/identity-and-office-365-presentation-on.html
Hope this helps.
Exchange mailbox access by API was disabled for that account. Please follow https://msdn.microsoft.com/en-us/library/office/dn467892(v=exchg.150).aspx to enable it, e.g. Set-CASMailbox –Identity adam#contoso.com -EwsEnabled:$true