I created a sample wcf REST service in .NET 3.5 vs.net 2008 Defined interface cdservice

public interface CdService
    [WebGet(UriTemplate = "service/*", ResponseFormat = WebMessageFormat.Xml)]
    string[] GetConfig();

Implemented GetConfig in Service1.cs

namespace CdService
  public class Service1 : CdService
    public string[] GetConfig()
    string[] services = new string[] { "Sales", "Marketing", "Finance" };
    return services;

Set virtual directory and pointed it to my project

I go to my virtual directory and try to browse service1.svc file, I get error message: You are not authorized to view this page Can someone please tell me what is wrong?
add comment

When I run the program it opens up browser and says:

You have created a service. To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax: svcutil.exe http://localhost:1496/Service1.svc?wsdl

When I change the URL to http://localhost:1496/Service1.svc/service/ Gives following error: Server Error in '/' Application. '/Service1.svc/service/' is not a valid virtual path.

I have two questions: 1) Please can someone tell why I am getting virtual path error? 2) Also How can I direct the service to a different port of my choice localhost:8080, so I can use access url localhost:8080/service/* to get the config results?

3 Years
Discussion Span
Last Post by Ketsuekiame

This isn't how WebGet UriTemplates work. You still need to call your method name:

You can edit your base config to change the port, it kind of depends how you're binding it though. If it's just through IIS, then you only need to set up the bindings in IIS itself (like you would for a normal website) otherwise you will need to edit the WCF Configuration itself.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.