Why “no http resource was found that matches the request URI”?
up vote
0
down vote
favorite
Hello guys i tried to make an api with ssms and visual studio. I saw a tutorial and although i made the steps exactly right, it returned me "no http resource was found that matches the request URI":
I have code in my controller like so:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using EmployeeDataAccess;
namespace EmployeeService1.Controllers
{
public class EmployeeController : ApiController
{
public IEnumerable<Signage> Get()
{
using (Raw_DataEntities entities = new Raw_DataEntities())
{
return entities.Signages.ToList();
}
}
public Signage Get(int fid)
{
using (Raw_DataEntities entities = new Raw_DataEntities())
{
return entities.Signages.FirstOrDefault(e => e.FID == fid);
}
}
}
}
WebApiConfig
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
namespace EmployeeService2
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Web API configuration and services
// Web API routes
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}
}
what am I doing so wrong? when i tried routing in a specified localhost it returns me this:
System.InvalidOperationException
HResult=0x80131509
Message=No connection string named 'Raw_DataEntities' could be found in the application config file.
Source=
StackTrace:
.net asp.net-web-api asp.net-web-api2
add a comment |
up vote
0
down vote
favorite
Hello guys i tried to make an api with ssms and visual studio. I saw a tutorial and although i made the steps exactly right, it returned me "no http resource was found that matches the request URI":
I have code in my controller like so:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using EmployeeDataAccess;
namespace EmployeeService1.Controllers
{
public class EmployeeController : ApiController
{
public IEnumerable<Signage> Get()
{
using (Raw_DataEntities entities = new Raw_DataEntities())
{
return entities.Signages.ToList();
}
}
public Signage Get(int fid)
{
using (Raw_DataEntities entities = new Raw_DataEntities())
{
return entities.Signages.FirstOrDefault(e => e.FID == fid);
}
}
}
}
WebApiConfig
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
namespace EmployeeService2
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Web API configuration and services
// Web API routes
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}
}
what am I doing so wrong? when i tried routing in a specified localhost it returns me this:
System.InvalidOperationException
HResult=0x80131509
Message=No connection string named 'Raw_DataEntities' could be found in the application config file.
Source=
StackTrace:
.net asp.net-web-api asp.net-web-api2
You need to set a connection string in your web.config file, like the error says
– matt_lethargic
Nov 7 at 11:04
@matt_lethargic web.config file connectionstring is not created...that's the mistake I think... so, do you have any idea what should i do? :/
– user10268549
Nov 7 at 11:17
Solved! :) Thank you
– user10268549
Nov 8 at 14:35
Do you want to update your question with how you solved it so that other people can learn?
– matt_lethargic
Nov 8 at 16:36
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Hello guys i tried to make an api with ssms and visual studio. I saw a tutorial and although i made the steps exactly right, it returned me "no http resource was found that matches the request URI":
I have code in my controller like so:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using EmployeeDataAccess;
namespace EmployeeService1.Controllers
{
public class EmployeeController : ApiController
{
public IEnumerable<Signage> Get()
{
using (Raw_DataEntities entities = new Raw_DataEntities())
{
return entities.Signages.ToList();
}
}
public Signage Get(int fid)
{
using (Raw_DataEntities entities = new Raw_DataEntities())
{
return entities.Signages.FirstOrDefault(e => e.FID == fid);
}
}
}
}
WebApiConfig
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
namespace EmployeeService2
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Web API configuration and services
// Web API routes
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}
}
what am I doing so wrong? when i tried routing in a specified localhost it returns me this:
System.InvalidOperationException
HResult=0x80131509
Message=No connection string named 'Raw_DataEntities' could be found in the application config file.
Source=
StackTrace:
.net asp.net-web-api asp.net-web-api2
Hello guys i tried to make an api with ssms and visual studio. I saw a tutorial and although i made the steps exactly right, it returned me "no http resource was found that matches the request URI":
I have code in my controller like so:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using EmployeeDataAccess;
namespace EmployeeService1.Controllers
{
public class EmployeeController : ApiController
{
public IEnumerable<Signage> Get()
{
using (Raw_DataEntities entities = new Raw_DataEntities())
{
return entities.Signages.ToList();
}
}
public Signage Get(int fid)
{
using (Raw_DataEntities entities = new Raw_DataEntities())
{
return entities.Signages.FirstOrDefault(e => e.FID == fid);
}
}
}
}
WebApiConfig
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
namespace EmployeeService2
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Web API configuration and services
// Web API routes
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}
}
what am I doing so wrong? when i tried routing in a specified localhost it returns me this:
System.InvalidOperationException
HResult=0x80131509
Message=No connection string named 'Raw_DataEntities' could be found in the application config file.
Source=
StackTrace:
.net asp.net-web-api asp.net-web-api2
.net asp.net-web-api asp.net-web-api2
edited Nov 7 at 10:46
asked Nov 7 at 10:35
user10268549
You need to set a connection string in your web.config file, like the error says
– matt_lethargic
Nov 7 at 11:04
@matt_lethargic web.config file connectionstring is not created...that's the mistake I think... so, do you have any idea what should i do? :/
– user10268549
Nov 7 at 11:17
Solved! :) Thank you
– user10268549
Nov 8 at 14:35
Do you want to update your question with how you solved it so that other people can learn?
– matt_lethargic
Nov 8 at 16:36
add a comment |
You need to set a connection string in your web.config file, like the error says
– matt_lethargic
Nov 7 at 11:04
@matt_lethargic web.config file connectionstring is not created...that's the mistake I think... so, do you have any idea what should i do? :/
– user10268549
Nov 7 at 11:17
Solved! :) Thank you
– user10268549
Nov 8 at 14:35
Do you want to update your question with how you solved it so that other people can learn?
– matt_lethargic
Nov 8 at 16:36
You need to set a connection string in your web.config file, like the error says
– matt_lethargic
Nov 7 at 11:04
You need to set a connection string in your web.config file, like the error says
– matt_lethargic
Nov 7 at 11:04
@matt_lethargic web.config file connectionstring is not created...that's the mistake I think... so, do you have any idea what should i do? :/
– user10268549
Nov 7 at 11:17
@matt_lethargic web.config file connectionstring is not created...that's the mistake I think... so, do you have any idea what should i do? :/
– user10268549
Nov 7 at 11:17
Solved! :) Thank you
– user10268549
Nov 8 at 14:35
Solved! :) Thank you
– user10268549
Nov 8 at 14:35
Do you want to update your question with how you solved it so that other people can learn?
– matt_lethargic
Nov 8 at 16:36
Do you want to update your question with how you solved it so that other people can learn?
– matt_lethargic
Nov 8 at 16:36
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
You web.config is missing the connection string named 'Raw_DataEntities', add this pointing to your database and it should work.
<connectionStrings>
<add name="Raw_DataEntities" connectionString="<your connection string" />
</connectionStrings>
that is the right answer.
– user10268549
Nov 12 at 11:37
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
You web.config is missing the connection string named 'Raw_DataEntities', add this pointing to your database and it should work.
<connectionStrings>
<add name="Raw_DataEntities" connectionString="<your connection string" />
</connectionStrings>
that is the right answer.
– user10268549
Nov 12 at 11:37
add a comment |
up vote
0
down vote
accepted
You web.config is missing the connection string named 'Raw_DataEntities', add this pointing to your database and it should work.
<connectionStrings>
<add name="Raw_DataEntities" connectionString="<your connection string" />
</connectionStrings>
that is the right answer.
– user10268549
Nov 12 at 11:37
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
You web.config is missing the connection string named 'Raw_DataEntities', add this pointing to your database and it should work.
<connectionStrings>
<add name="Raw_DataEntities" connectionString="<your connection string" />
</connectionStrings>
You web.config is missing the connection string named 'Raw_DataEntities', add this pointing to your database and it should work.
<connectionStrings>
<add name="Raw_DataEntities" connectionString="<your connection string" />
</connectionStrings>
answered Nov 8 at 16:39
matt_lethargic
1,98511222
1,98511222
that is the right answer.
– user10268549
Nov 12 at 11:37
add a comment |
that is the right answer.
– user10268549
Nov 12 at 11:37
that is the right answer.
– user10268549
Nov 12 at 11:37
that is the right answer.
– user10268549
Nov 12 at 11:37
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53187726%2fwhy-no-http-resource-was-found-that-matches-the-request-uri%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You need to set a connection string in your web.config file, like the error says
– matt_lethargic
Nov 7 at 11:04
@matt_lethargic web.config file connectionstring is not created...that's the mistake I think... so, do you have any idea what should i do? :/
– user10268549
Nov 7 at 11:17
Solved! :) Thank you
– user10268549
Nov 8 at 14:35
Do you want to update your question with how you solved it so that other people can learn?
– matt_lethargic
Nov 8 at 16:36