0

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?

Sisyphus
  • 900
  • 12
  • 32

2 Answers2

0

you need to register the .svc mime type in your IIS

run "\%windir%\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe -i"

nunob
  • 592
  • 7
  • 24
  • Thanks a lot for your help, the IIS seems to understand service files now, but unfortunately I am receiving this exception now. Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' – Sisyphus Nov 17 '14 at 16:33
  • problem solved at http://stackoverflow.com/questions/15688930/could-not-load-type-system-servicemodel-activation-httpmodule-from-assembly-s – Sisyphus Nov 17 '14 at 16:44
0

Here is a full guide, please apply all steps:

  1. Add “.svc” extension and MIME Type as “application/octet-stream” to IIS Mime Type in Features View.
  2. Register Asp.net by running aspnet_regiis.exe -i command from VS 2010 command prompt (Run as admin).
  3. Right click cmd, run as admin, go to “C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation” folder and run : ServiceModelReg.exe -i

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".

Samidjo
  • 2,315
  • 30
  • 37