I have a web server inside a virtual machine and a client out of it.
For the server side I'm using .NET Framework 4.6.1
This is the structure for my WEB API controller (server-side):
// GET: api/Users
public IQueryable<Users> GetUsers()
{
db.Configuration.ProxyCreationEnabled = false;
return db.Users;
}
// GET: api/Users/5
[ResponseType(typeof(Users))]
public IHttpActionResult GetUsers(string id)
{
db.Configuration.ProxyCreationEnabled = false;
Users users = db.Users.Find(id);
if (users == null)
{
return NotFound();
}
return Ok(users);
}
If I write on the browser ( inside the virtual machine) http://localhost:50347/api/Users/id the IIS express answer me (correctly) through the browser.
The client side makes this call (typescript):
login(account: Account): Observable<Utente> {
let apiURL = `${URL.LOGIN}/${account.username}`;
return this.http.get<Utente>(apiURL);
that exactly call http://10.211.55.5/api/Users/id.
If I try to call http://10.211.55.5/api/Users/id directly on the browser, the browser give me this "error":
This XML file does not appear to have any style information associated with it. The document tree is shown below.
I hope someone can help me. Thank you in advance.
that exactly call http://10.211.55.5/api/Users/id
? That means you are trying to find a user whose Primary Key value is the stringid
? In that casedb.Users.Find
will probably throw an exception.This XML file does not appear to have any style information associated with it. The document tree is shown below.
isn't an error message anyway, that's shown for any XML response that doesn't have a link to a styelsheet. – Panagiotis Kanavos