2

我在让 ServiceStack 在运行在 IIS 8.0 上的 Arvixe ASP.NET 服务器上工作时遇到了一些问题。

我按照http://servicestack.net/ServiceStack.Hello/上的教程,创建了一个空的 ASP.NET Web 应用程序并在包管理器控制台中发出命令“PM> Install-Package ServiceStack.Host.AspNet”。

完成此操作后,我可以从本地主机上的 Visual Studio 运行 Web 应用程序,Todo 应用程序运行良好,我可以调用 /hello/{Name} url 来获得正确的结果。

然后我尝试将项目上传到我在 IIS 8.0 上运行的 Arvixe ASP.NET 服务器,但在这里它不起作用。Todo 应用程序加载但无法添加项目,当我尝试访问 /metadata 或 /hello/{Name} 时,我收到 HTTP 错误 404.0 - 未找到,如下所示:

在此处输入图像描述

我对 ServiceStack 完全陌生,所以我不知道如何解决这个问题。有人能告诉我应该怎么做才能让它工作吗?

编辑

我的 Web.config

<?xml version="1.0" encoding="utf-8"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

<configuration>
  <connectionStrings>
    <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
  </connectionStrings>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />

    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login.aspx" timeout="2880" />
    </authentication>

    <membership>
      <providers>
        <clear />
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
      </providers>
    </membership>

    <profile>
      <providers>
        <clear />
        <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
      </providers>
    </profile>

    <roleManager enabled="false">
      <providers>
        <clear />
        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
        <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
      </providers>
    </roleManager>

  <httpHandlers><add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" /></httpHandlers></system.web>

  <system.webServer>
     <modules runAllManagedModulesForAllRequests="true" />
  <validation validateIntegratedModeConfiguration="false" />
    <handlers><add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" /></handlers></system.webServer>
</configuration>
4

2 回答 2

1

解决了

我发现了问题所在:我必须手动上传 Visual Studio 生成的 Web.config 文件。将此文件上传到网络服务器的根目录后,该示例就可以正常工作。显然,当使用 Visual Studio 2010 发布时,Web.config 文件不会自动上传到服务器。

于 2013-08-19T10:14:32.677 回答
0

实际上 web.config 是在您使用 Visual Studio 2010 发布网站时上传的。必须有一个设置,您不允许 web.config 上传。

于 2013-11-12T15:04:39.473 回答