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:










share|improve this question
























  • 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















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:










share|improve this question
























  • 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













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:










share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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


















  • 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












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>





share|improve this answer





















  • that is the right answer.
    – user10268549
    Nov 12 at 11:37











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















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
























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>





share|improve this answer





















  • that is the right answer.
    – user10268549
    Nov 12 at 11:37















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>





share|improve this answer





















  • that is the right answer.
    – user10268549
    Nov 12 at 11:37













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>





share|improve this answer












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>






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 8 at 16:39









matt_lethargic

1,98511222




1,98511222












  • 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




that is the right answer.
– user10268549
Nov 12 at 11:37


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














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





















































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







這個網誌中的熱門文章

Xamarin.form Move up view when keyboard appear

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Anylogic : not able to use stopDelay()