CSS Solved Papers
Physics Chemistry

Engineering :: MVC

  A generic walk through for creating and hosting web api service on local iis server
generate a web api from Visual studio..
add models and create related api controllers (synchronus or asyncho....)

for db settings go to project -> appname properties.
Also enable System.Web.Http.Cors; by web api cross ... from nuget package

add config.EnableCors(); in webapiconfig and on controller classes as

[EnableCors(origins: "http://localhost:1122", headers: "*", methods: "*")]
public class TemplatesController : ApiController
in web.config edit as

< system.webServer >

right click and publish with file system....

now run iis on local system by windows+R + inetmgr and ok and add web site .. enter the related info also press Connect as for the specific user and also test connection.. with generic user test connection gives warning for authorization or authentication..

after adding website click on Application Pools and slect the added web site and advance settings and then change to local system selction from identity that was applicationpoolidentity by default...
run your service in browser and if db fails then check for user in sqlserver that have system admininstrative roles or not for fetching data from db

Write your comments here:
Name *:     Email:

© 2012-2024 by GeekMCQ™ Technologies. All Rights Reserved | Copyright | Terms of Use & Privacy Policy | Referals

Contact us: