0

All of a sudden my app won't display a page and I now get "You do not have permission to view this directory or page." I looked at this but the suggestions there didn't help.

for my code:

[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
// NOTE: If this class is renamed, remember to update the global.asax.cs file
public class Service
{
    [WebGet(UriTemplate = "")]
    public string GetTest()
    {
        return "Windward update REST service running.";
    }
}

When I request an aspx page, it works.

Global.asx.cs:

public class Global : HttpApplication
{
    private static readonly ILog log = LogManager.GetLogger(typeof(Global));

    void Application_Start(object sender, EventArgs e)
    {
        RegisterRoutes();

        log4net.Config.XmlConfigurator.Configure();
        log.Info(string.Format("Update REST server started, running under user {0}", WindowsIdentity.GetCurrent().Name));
    }

    private void RegisterRoutes()
    {
        // The class providing the REST service
        RouteTable.Routes.Add(new ServiceRoute("Service", new WebServiceHostFactory(), typeof(Service)));
    }

web.config (relevant parts):

  <system.web>
    <compilation debug="true" targetFramework="4.5"/>
    <pages controlRenderingCompatibilityVersion="4.0"/>
  </system.web>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
    </modules>
  </system.webServer>
  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
    <standardEndpoints>
      <webHttpEndpoint>
        <!-- 
            Configure the WCF REST service base address via the global.asax.cs file and the default endpoint 
            via the attributes on the <standardEndpoint> element below
        -->
        <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true"/>
      </webHttpEndpoint>
    </standardEndpoints>
  </system.serviceModel>

Nothing substantive has changed. So why do the requests no longer call the service?

thanks - dave

Community
  • 1
  • 1
David Thielen
  • 28,723
  • 34
  • 119
  • 193
  • Have you deployed to a server in which the root folder is accessed differently than before? For example, www.myweb.com/MyApp/Home/ and www.myweb2.com/MyApp/ where MyApp is being routed to MyApp/Home/ – Ross Bush Dec 10 '14 at 20:26
  • No. This was working both running from VS2013 and Azure, and now the same error on both. – David Thielen Dec 10 '14 at 20:27
  • Where is the aspx page you speak of. Is it in the Views/Partials? – Ross Bush Dec 11 '14 at 16:14

0 Answers0