Error 403 when browsing to Service.svc file

I am trying to run one of the wcf samples. I am deploying the server to IIS 6 and keep getting Http Error 403 Forbidden when I try to browse to the service.svc file. The directory and files appear to have the right permissions set.

I added a Default.aspx page to the same directory and it works fine. I changed to Basic authentication and the Service.svc file returns the 403 error before I am even prompted to login. The Default.aspx page prompts me to login and then displays correctly.

I had the sample working fine on my Windows XP workstation it just won't run on Windows Server 2003.

Does anyone know what else I can check to get this working Thanks,

Matthew



Answer this question

Error 403 when browsing to Service.svc file

  • Nico Vuyge

    Hello,

    What happens if you try to browse the service's WSDL, i.e., http://xxx/Service.svc wsdl, inside the browser

    Thanks.


  • Walter Luszczyk

    Hi Mathew, it seems like ASP.NET is not enabled on your box. Can you run the following command to see whether it works

    %windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i -enable

    Please also try to access a simple .aspx page to see what you get if this won't help.


  • GAtkins

    Sajay,

    Yes, That is exactly what I did. I put a simple Default.aspx page into the same directory as the Service.svc file and the Default.aspx file works.

    Matthew


  • JoeL7034

    Sajay, I tried running the ServiceModelReg again. I tried -i and -r and then did -lv at the end so you can see the script map version listing. No help. I still get access denied 403 when I browse

    C:\WINDOWS\Microsoft.NET\Framework\v3.0\Windows Communication Foundation>servicemodelreg.exe -i
    Microsoft(R) Windows Communication Foundation Installation Utility
    [Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.30]
    Copyright (c) Microsoft Corporation. All rights reserved.


    Installing: Machine.config Section Groups and Handlers

    Installing: System.Web Build Provider

    Installing: System.Web Compilation Assemblies

    Installing: HTTP Handlers

    Installing: HTTP Modules

    Installing: Web Host Script Mappings

    C:\WINDOWS\Microsoft.NET\Framework\v3.0\Windows Communication Foundation>servicemodelreg.exe -r
    Microsoft(R) Windows Communication Foundation Installation Utility
    [Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.30]
    Copyright (c) Microsoft Corporation. All rights reserved.


    Warning: You are about to uninstall a set of Windows Communication Foundation components.
    This could lead to damaging existing applications that rely on Windows Communication Foundation configuration.
    The affected components are:
    Machine.config Section Groups and Handlers
    System.Web Build Provider
    System.Web Compilation Assemblies
    HTTP Handlers
    HTTP Modules
    Web Host Script Mappings
    Are you sure (Y/N) y

    Uninstalling: Machine.config Section Groups and Handlers

    Installing: Machine.config Section Groups and Handlers

    Uninstalling: System.Web Build Provider

    Installing: System.Web Build Provider

    Uninstalling: System.Web Compilation Assemblies

    Installing: System.Web Compilation Assemblies

    Uninstalling: HTTP Handlers

    Installing: HTTP Handlers

    Uninstalling: HTTP Modules

    Installing: HTTP Modules

    Uninstalling: Web Host Script Mappings

    Installing: Web Host Script Mappings

    C:\WINDOWS\Microsoft.NET\Framework\v3.0\Windows Communication Foundation>servicemodelreg.exe -lv
    Microsoft(R) Windows Communication Foundation Installation Utility
    [Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.30]
    Copyright (c) Microsoft Corporation. All rights reserved.


    Installed versions of Machine.config Section Groups and Handlers:
    system.serviceModel : 3.0.0.0
    system.runtime.serialization : 3.0.0.0
    system.serviceModel.activation : 3.0.0.0

    Installed versions of System.Web Build Provider:
    3.0.0.0

    Installed versions of System.Web Compilation Assemblies:
    System.Runtime.Serialization, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchit
    ecture=MSIL
    System.IdentityModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=M
    SIL
    System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

    Installed versions of HTTP Handlers:
    *.svc : 3.0.0.0

    Installed versions of HTTP Modules:
    ServiceModel : 3.0.0.0

    Installed versions of Web Host Script Mappings:
    .svc,C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG

    C:\WINDOWS\Microsoft.NET\Framework\v3.0\Windows Communication Foundation>


  • Deefken

    Sorry about the late reply http://msdn2.microsoft.com/en-us/library/ms732012.aspx

    Could you also check your event log besides registering the scripts maps. Also do make sure of the version on the directory in IIS. it should be 2.0



  • decent7772003

    Yes. I installed the .Net framework 3.0 runtime. I also ran the script to register the WCF file extensions on IIS. In the configuration the .svc extension is mapped to the correct dll file. I went through all the instructions in the help for the one time setup that came with the WCF samples.
  • Nfrf

    The event log does not show any errors or problems that I can find. The ASP.NET version is 2.0.50727

    Thanks,

    Matthew


  • Hussain Saffar

    Are you still out there Sajay
  • Ayhan Yerli (TR-NL)

    Did you remember to install the WCF run-time on the WinServer2003 where you host your service in IIS

  • omp4u

    Sajay,

    Actually that is exactly what I have been trying to do. The browser immediatly returns a 403 error. It does not matter if I browse from the local host or from my PC. In order to verify that the ACLs were right I added a Default.aspx page in the same directory as the Service.svc file and that works file. That leads me to believe that it is not an ACL issue but some other configuration switch I am not aware of.

    Thanks,

    Matthew

    Here is the web.config

    < xml version="1.0" encoding="utf-8" >
    <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
    <system.serviceModel>
    <services>
    <service
    name="Microsoft.ServiceModel.Samples.CalculatorService"
    behaviorConfiguration="CalculatorServiceBehavior">
    <!-- This endpoint is exposed at the base address provided by host: http://localhost/servicemodelsamples/service.svc -->
    <endpoint address=""
    binding="wsHttpBinding"
    contract="Microsoft.ServiceModel.Samples.ICalculatorConcurrency" />
    <!-- the mex endpoint is exposed at http://localhost/servicemodelsamples/service.svc/mex -->
    <endpoint address="mex"
    binding="mexHttpBinding"
    contract="IMetadataExchange" />
    </service>
    </services>

    <!--For debugging purposes set the includeExceptionDetailInFaults attribute to true-->
    <behaviors>
    <serviceBehaviors>
    <behavior name="CalculatorServiceBehavior">
    <serviceMetadata httpGetEnabled="True"/>
    <serviceDebug includeExceptionDetailInFaults="True" />
    </behavior>
    </serviceBehaviors>
    </behaviors>

    </system.serviceModel>

    <system.web>
    <compilation defaultLanguage="c#" />
    </system.web>
    </configuration>


  • Radomiak

    Wenlong,

    Thanks for your reply. I have already tried both of your suggestions but it did not help. I tried once more running aspnet_regiis.exe as you suggested because I don't think I used these same options before. The aspx page that is in the same directory as the Service.svc file works fine so I think that ASP.NET is installed and enabled. The Service.svc file still returns an Access Denied error.

    Matthew


  • S&amp;#233;bastien Nunes

    This error still exists after you run servicemodelreg

  • Corres

    Try to open the service in the browser. Next check if yoru endpoint is configured to the same address that you used in the browser or that displayed int he page when you open in the browser.

  • JohnGBunch

    Can you check if your virtual directory is setup correctly with asp.net version 2.0 and try browsing another aspx page.



  • Error 403 when browsing to Service.svc file