I am trying to use an already existing ASP.net web application to host a WCF service, so I tried the following steps,
1- In Visual Studio 2010, I created web application through the Web > ASP.net Web Application template, named WebApp .
2- Added new WCF Service through Add > New Item ... > WCF Service , named MyServ .
3- Modified the DoWork()
method in MyServ.svc as follows,
From
public void DoWork()
{
}
To
public string DoWork()
{
return "hello";
}
and consequently I modified IMyServ.cs to match the new signature.
4- When I run the application on development server and visit http://localhost:1399/MyServ.svc
, the service runs fine.
5- So I create a publish for this application, to prepare it to be hosted on the IIS.
6- In the IIS, I create a new website named WebAppSite and is given the port 111, so now when I visit http://localhost:111/
, I am directed for the published WebApp site default page, which is fine and shows that the aspx part of the application is working fine on the IIS.
7- So I try to visit http://localhost:111/MyServ.svc
to check if the service is successfully deployed, but I get this message,
HTTP Error 404.3 - Not Found The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
Any idea where the problem is?
you need to register the .svc mime type in your IIS
run "\\%windir%\\Microsoft.NET\\Framework\\v3.0\\Windows Communication Foundation\\ServiceModelReg.exe -i"
Here is a full guide, please apply all steps:
If you did some changes in your IIS, you may need to go to handler mappings, right click on the static file and select "Revert to Parent".
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.