|
I went through his blog right before I posted. After adding the binding line to the .config, then running my app, I get
"Process with an Id of [some id] is not running."
Here's my config entries
<site name="RemoteServices.BusinessServices" id="6">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Projects\RemoteServices.BusinessServices" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:53175:localhost" />
<binding protocol="http" bindingInformation="*:53175:192.168.51.66"
</site>
I closed an reopened vs and my web api project failed to load. Commented out the line in the .config and everythign is back to normal.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Kevin Marois wrote: <binding protocol="http" bindingInformation="*:53175:192.168.51.66" //<I added this
Is that a typo in your question, or did you really miss out the closing /> from that element?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Yes, it was a typo. Fixed it and all works as expected.
Thank you again
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Richard,
I'm back to this again. I had this working and now it doesn't.
I went back & checked my work. I did the following:
IIS Config
<bindings>
<binding protocol="http" bindingInformation="*:53122:localhost" />
<binding protocol="http" bindingInformation="*:53125:192.168.51.66" />
</bindings>
I also ran
netsh http add urlacl url=http:
netsh advfirewall firewall add rule name="ePlex Remote Services" dir=in protocol=tcp localport=53125 profile=private remoteip=localsubnet action=allow
When I run the web api from my dev pc it works fine. But when I try to hit 192.168.51.66:53125 from another PC it can't find it.
I'm not sure how to debug this. Any thoughts?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Is the API project running when you try to access it from the remote PC?
Is the firewall's "private" profile active?
Is the remote PC on the same local subnet as your dev PC?
Try turning on logging for the firewall to see if that gives you any information:
How to Track Firewall Activity with the Windows Firewall Log[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Well, I fixed it, but I don't know what was wrong.
First, I went through all your suggestions. Still couldn't get it to work.
So I removed & recreated the Web API project, ran the steps from that blog, and bingo - back & and accessable remotely again.
Thanks for your help again.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
I'm trying to call a method on my Operator controller called AddOperator
[HttpPost]
public void AddOperator(OperatorEntity entity)
{
var bl = GetBusinessLayer();
bl.Add(entity);
}
RestClient baseURl is "{http://localhost.fiddler:53175/api}"
The RestRequest.Resource is "/Operator/AddOperator/".
The RestRequest.Parameters collection has one entry which is an instance of the OperatorEntity.
Fiddler Output
GET http:
Accept: application/json, text/json, text/x-json, text/javascript, application/xml, text/xml, text/plain
User-Agent: RestSharp/106.6.7.0
Host: localhost:53175
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Notice the GET in the output.
I'm really new to WebAPI's, but I thought that I needed to mark the controller method with [HttpPost] , yet that doesn't seem to work.that
What am I doingwrong here?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
You do need to mark the method with [HttpPost] (or technically, [HttpPut] if this is a REST API).
The client call is using the wrong HTTP method.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
ya, that was it. Thank you sir!
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
I'm working on a WPF app against an ASP.Net MVC Web API.
I'm trying to implement a delete in my Operator controller. I'm getting
System.Exception: 'An error occured calling the WebAPI.
The status code is 'MethodNotAllowed'.
The error message is {"Message":"The requested resource does not support http method 'DELETE'."}'
Client Side Proxy
public async Task DeleteOperatorAsync(Guid id)
{
await Task.Factory.StartNew(() =>
{
var webAPIExecutor = new WebAPIExecutor(ServerUrl, "/Operator/Delete/", Method.DELETE);
webAPIExecutor.AddParameter(id, "id");
webAPIExecutor.Execute();
});
}
Controller
[HttpDelete]
public void Delete(Guid id)
{
IBusinessLayer bl = new BusLayer();
bl.DeleteOperator(id);
}
The class WebAPIExecutor is working fine for all other calls so it's most likely not the problem, but I can post it if someone wants to see it.
Fiddler shows this info
DELETE <a href="http://localhost:53175/api/Operator/Delete/">http:
Accept: application/json, text/json, text/x-json, text/javascript, application/xml, text/xml, text/plain
User-Agent: RestSharp/106.6.7.0
Content-Type: application/json
Host: localhost:53175
Content-Length: 38
Accept-Encoding: gzip, deflate
"77932bef-1b12-4204-9bd7-9a50f854a72a"
All other Web API calls are working. Canyone know what's wrong?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
I suspect it's because you're passing the parameter in the request body, rather than in the URL:
ASP.NET web API HTTP Delete 405 Method Not Allowed - Stack Overflow[^]
You might need to add the [FromBody] attribute to your parameter:
Using [FromBody] | Parameter Binding in ASP.NET Web API | Microsoft Docs[^]
Slightly off-topic:
public async Task DeleteOperatorAsync(Guid id)
{
await Task.Factory.StartNew(() =>
{
var webAPIExecutor = new WebAPIExecutor(ServerUrl, "/Operator/Delete/", Method.DELETE);
webAPIExecutor.AddParameter(id, "id");
webAPIExecutor.Execute();
});
}
That just looks nasty. It would be better to make your WebAPIExecutor class expose async methods. The Execute method is IO-bound, not CPU-bound, so pushing the work onto a background thread doesn't make much sense.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
That did it. I set the FromBody attrib and it worked.
As far as the Executor, here's the Execute code:
public void Execute()
{
URL = client.BaseUrl + request.Resource;
IRestResponse result = null;
try
{
result = client.Execute(request);
int resultCode = (int)result.StatusCode;
if (resultCode > 299)
{
string message = string.Format("An error occured calling the WebAPI. {0} The status code is '{1}'. {2} The error message is {3}",
Environment.NewLine, result.StatusCode, Environment.NewLine, result.Content);
throw new Exception(message);
}
}
catch (Exception e)
{
throw e;
}
}
Not sure what in here I could await. The RestClient doesn't expose any async methods.
Your thoughts?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Is that RestSharp[^]?
If so, there's an ExecuteTaskAsync method that would work:
RestSharp/RestClient.Async.cs at 64357df6f8c428f3b39e78ab4b3034596dd2e953 · restsharp/RestSharp · GitHub[^]
Also:
Quote:
catch (Exception e)
{
throw e;
}
Don't do that. You've just thrown away the stack trace of the exception. If you have to catch and rethrow, just use throw; instead of throw e; . But in this case, since you're not doing anything with the exception, you can just remove the try..catch block.
And:
Quote:
throw new Exception(message);
I wish Microsoft had made the Exception class abstract ; there's never a good reason to throw new Exception(...); instead of using a more specific exception type.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: If so, there's an ExecuteTaskAsync method that would work:
You're right. Not sure why I didn't se that.
As far as the rest... we're just prototyping right now, so I'm throwing just in the interim. We'll be adding in more robust exception handling later.
Thanks for all your help
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Hello everyone.
I have a asp.net core 2.1 project, where i need to use the adfs as an external authentication provider.
I just can't find a working solution and i'm getting a little bit desperate, so can anyone please help me!
Prefereably i'm looking for a solution via Oauth2 protocol.
I found one working solution with WS-federation (cookie based) - LINK, the authentication work just fine, the app first checks if an user is logged in, if not it redirects to adfs external login page and after a successful login it redirects back to the app and shows the data. There is just one small problem, i don't know how to get user info (user id, upn ...).
Thank you in advance and have a nice day.
.
|
|
|
|
|
Caveat - I don't use oAuth.
_dk6607 wrote: i don't know how to get user info (user id, upn ...).
I would think you would just get the fact that the user is authenticated/Authorised as a return from the external logon. UserID and password should not be available.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
If you looked at the article from the link, you would see you can get a lot of information about the user, who has logged in, dependes on the configuration on the adfs.
The adfs communicates with ad (active directory) and gets the user info back as claims. Then the adfs returns data to the app as an encrypted token.
Here is the problem, i don't know how to solve, get the claims out of the token.
|
|
|
|
|
|
I've been googling this topic and I'm finding conflicting messages regarding which one to choose, as well as in CRaP ( Core Razor Pages ).
I suspect that Microsoft will abandon MVC in the next year or so, so there is that concern.
Organizationally speaking, CRaP is easier on the solution explorer browsing.
I read one view that said MVC is better for large apps, and CRaP was better for small single-page apps, but I read another item that says MVC doesn't scale as well as CRaP.
----------------
Regarding CRaP:
There appear to be two ways to "compartmentalize" large sites:
0) Add an Areas folder in the project root (requires a few settings changes in the app to allow areas)
1) Add a Features folder to the (generated) Pages folder
It seems to me that either is viable, but I'm wondering which would be "better", and why.
---------------------
Apparently you can mix/match MVC and CRaP, but I want to avoid doing that (to mitigate complexity), thus rendering that possibility off-topic for this thread.
Discuss...
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
John Simmons / outlaw programmer wrote: I suspect that Microsoft will abandon MVC in the next year or so, so there is that concern.
They've barely abandoned WebForms, so I seriously doubt they'll be chucking MVC under the bus any time soon.
Also, it's all "open source" now, so it would be much harder for Microsoft to abandon the project if the community still wants to keep it running.
John Simmons / outlaw programmer wrote: I read another item that says MVC doesn't scale as well as CRaP.
Were they comparing CRaP to "Core" MVC, or MVC5? I've seen lots of talk about Core being faster than MVC5 - and potentially getting even faster when they bring it back in-process in IIS - but I've not seen anyone suggesting that there's a difference between Core MVC and CRaP.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: Were they comparing CRaP to "Core" MVC, or MVC5?
I suspect it was MVC5.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
I have a Core 2.1 Razor Pages solution that contains a number of discreet web apps. All of these apps share a number of css, image and partial page files.
To "share" these files, I created a solution folder (in the VS2017 Solution Explorer) called "Common", and inside that folder, I put various files into this folder.
Question - Even though I created the folder in the solution explorer, there is no "Common" folder anywhere in the folder hierarchy. Instead, all of the files I put into the Common folder were placed in the solution's root folder. Did I do it wrong?
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
What is different is:
IT WORKS
<div class = "carousel-inner">
<div class = "carousel-item active">
<img src = "https://www.w3schools.com/bootstrap4/la.jpg" alt = "Los Angeles" height = "100">
</ Div>
<div class = "carousel-item">
<img src = "https://www.w3schools.com/bootstrap4/la.jpg" alt = "Chicago" height = "100">
</ Div>
<div class = "carousel-item">
<img src = "https://www.w3schools.com/bootstrap4/la.jpg" alt = "New York" height = "100">
</ Div>
</ Div>
from this:
IT DOES NOT WORK
<div class = "carousel-item active">
<img src = "advertisement / reklama1.jpg" alt = "ad1" height = "100">
</ Div>
<div class = "carousel-item">
<img src = "advertisement / reklama2.jpg" alt = "ad2" height = "100">
</ Div>
<div class = "carousel-item">
<img src = "advertisement / reklama3.jpg" alt = "reklama3" height = "100">
</ Div>
Maybe I'm dumb, I do not know.
I even entered the ADDRESS OF YOUR WEBSITE and it does not work.
But as there are pictures from w3schools it works.
WTF?
I also saw:
https://github.com/Dogfalo/materialize/issues/3899
https://github.com/archriss/r[...]tive-snap-carousel/issues/371
But it does not tell me anything.
|
|
|
|
|
First of all, is this based on an article somewhere here on the site? If it is, that's where you should be asking your questions. It's extremely unlikely that the author will come across this post and realise it's for them.
Second, when talking about an error, it's a good idea to tell us what the problem actually is. Right now, we have to take a look at your question and guess what the problem is.
Third, the structure of the divs is different - you don't have a containing div with carousel-inner. Now, you might have it in your code and you just forgot to post it here but without the context of the problem, we can't tell.
Fourth, the image src is invalid. You have stray spaces in the src.
This space for rent
|
|
|
|
|
There is no problem with paths. The problem was the name of the file and directory. And so the name.
The DIV structure is the same, in the second chapter it did not copy to me. The ad blocking tool cut out this carousel by the name of the files in the format "advertisement1" and the folder: "advertisement". After changing the file name to 1.jpg and folder on "aa" the problem disappeared.
|
|
|
|
|