1

When i'm launch my web api application from visual studio all seems to work perfect. But when i'm trying to publish it and run it via IIS7 it doesnt work.

First step i create a controller with name Person.

public class PersonController : ApiController { // GET: api/Person public IEnumerable<string> Get() { return new string[] { "value1", "value2" }; } // GET: api/Person/5 public string Get(int id) { return "value"; } // POST: api/Person public void Post([FromBody]string value) { } // PUT: api/Person/5 public void Put(int id, [FromBody]string value) { } // DELETE: api/Person/5 public void Delete(int id) { } 

Then i'm choosing Publish, and selecting IIS,FTP,etc. Then i'm selecting Filesystem and rooting my path:

Path

Here is my files inside folder

Files

Then inside IIS i choose add new web site:

Config

Now when i'm opening and trying to access in my controller i'm getting error below: http://localhost:8080/FirstSite/api/person

ErrorImage

Is there something am i doing wrong? Is there something wrong with my files which i export?

Chack configuration

1
  • You should use a URL like http://localhost:8080/api/person. Commented Oct 4, 2018 at 13:06

3 Answers 3

1

If you added a website and left the hostname blank, you should access your API at http://localhost:8080/api/person

Sign up to request clarification or add additional context in comments.

6 Comments

Check if the website is using the appropriate Application pool. .Net Framework Version: 4.0 Pipeline Mode: Integrated
I change it, but i have the same issue. If i will run 192.168.0.214:8080/HtmlPage1.html my page opens. But if i will run 192.168.0.214:8080/api/person it doenst
Is this the first time you will use your IIS with ASPNet? If yes, you might need to register your IIS. You will need to execute the following: aspnet_regiis.exe -i aspnet_regiis.exe -ga {user} aspnet_regbrowsers.exe -i See here for details msdn.microsoft.com/en-us/library/k6h9cz8h.aspx msdn.microsoft.com/en-us/library/ms229858.aspx
It didn't worked. I can't understand where is my problem
If you've done that and still not working, try running iisreset.exe
|
1

try adding the below to your hosted web.config

<system.webServer> <modules> <remove name="UrlRoutingModule-4.0" /> <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" /> </modules> </system.webServer> 

1 Comment

Here is what i cave now in web config: <system.webServer> <handlers> <remove name="ExtensionlessUrlHandler-Integrated-4.0" /> <remove name="OPTIONSVerbHandler" /> <remove name="TRACEVerbHandler" /> <add name="Aspnet" path=".asax" verb="" type=".asax" resourceType="Unspecified" preCondition="integratedMode" /> <add name="ExtensionlessUrlHandler-Integrated-4.0" path="." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> </handlers> </system.webServer>
0

Solved. Just neet to set identity in advanced settings as Local System img

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.