0

我已经更换了服务提供商,从那时起,只要我转到 www.greptech.co.za,我就会收到上述错误。

服务提供商正在使用 .NET 4.0,并且确实安装了最新的 MVC3 并且是最新的。

还有什么问题?我已经用谷歌搜索了这个,我已经完成了上述检查。服务提供商不知道还有什么问题。

我没有更改我的 Web.config 文件,因为它正在使用我的旧服务提供商。

网站已经关闭了很长时间。请问谁能帮忙

这是我的 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=152368
      -->
    <configuration>
      <connectionStrings>
        <add name="MySqlServer" connectionString="Datasource=431.186.904.538;Port=3306;Database=grep;uid=user;pwd='XXXX';Allow User Variables=true;check parameters=false;logging=true" providerName="MySql.Data.MySqlClient" />
      </connectionStrings>

      <system.net>
        <mailSettings>
          <smtp deliveryMethod="Network" from="support@greptech.co.za">
            <network host="mail.greptech.co.za" userName="support@greptech.co.za" password="XXXX" port="25" />
          </smtp>
        </mailSettings>
      </system.net>

      <appSettings>
        <add key="ENV" value="PROD"/>
        <add key="webpages:Version" value="1.0.0.0" />
        <add key="ClientValidationEnabled" value="true" />
        <add key="UnobtrusiveJavaScriptEnabled" value="true" />
      </appSettings>

      <system.web>
        <!--   <customErrors mode="On"/> -->
        <trace enabled="true" pageOutput="false" requestLimit="40" localOnly="false" />

        <compilation debug="true" targetFramework="4.0">

          <assemblies>
            <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
          </assemblies>
        </compilation>

        <authentication mode="Forms">
          <forms loginUrl="~/Account/LogOn" timeout="2880" />
        </authentication>

       <pages>
          <namespaces>
            <add namespace="System.Web.Helpers" />
            <add namespace="System.Web.Mvc" />
            <add namespace="System.Web.Mvc.Ajax" />
            <add namespace="System.Web.Mvc.Html" />
            <add namespace="System.Web.Routing" />
            <add namespace="System.Web.WebPages" />
          </namespaces>
        </pages>
        <customErrors mode="Off"/>
      </system.web>

      <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <modules runAllManagedModulesForAllRequests="true" />
            <directoryBrowse enabled="true" />
            <defaultDocument>
                <files>
                    <clear />
                    <add value="Default.htm" />
                    <add value="Default.asp" />
                    <add value="index.htm" />
                    <add value="index.html" />
                    <add value="iisstart.htm" />
                    <add value="default.aspx" />
                    <add value="index.php" />
                </files>
            </defaultDocument>
              </system.webServer>

      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    </configuration>

好的,感谢您的回复.. 这是 ~/Views/Web.config

    <?xml version="1.0"?>

    <configuration>
      <configSections>
        <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
          <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
          <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
        </sectionGroup>
      </configSections>

      <system.net >
        <mailSettings>
          <smtp deliveryMethod="Network" from="support@greptech.co.za">
            <network host="mail.greptech.co.za" userName="support@greptech.co.za" password="XXXX" port="25" />
          </smtp>
        </mailSettings>
      </system.net>

      <system.web.webPages.razor>
        <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <pages pageBaseType="System.Web.Mvc.WebViewPage">
          <namespaces>
            <add namespace="System.Web.Mvc" />
            <add namespace="System.Web.Mvc.Ajax" />
            <add namespace="System.Web.Mvc.Html" />
            <add namespace="System.Web.Routing" />
          </namespaces>
        </pages>
      </system.web.webPages.razor>

      <appSettings>
        <add key="webpages:Enabled" value="false" />
      </appSettings>

      <system.web>
        <httpHandlers>
          <add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
        </httpHandlers>

        <!--
            Enabling request validation in view pages would cause validation to occur
            after the input has already been processed by the controller. By default
            MVC performs request validation before a controller processes the input.
            To change this behavior apply the ValidateInputAttribute to a
            controller or action.
        -->
        <pages
            validateRequest="false"
            pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
            pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
            userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
          <controls>
            <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
          </controls>
        </pages>
      </system.web>

      <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />

        <handlers>
          <remove name="BlockViewHandler"/>
          <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
        </handlers>
      </system.webServer>
    </configuration>

我最终回到原来的服务提供商

4

2 回答 2

0

我想我可能知道查看调试输出发生了什么 - 这部分看起来不正确:

Line 12:   namespace ASP {
Line 13:       using System;
Line 14:       using System.Collections.Generic;
Line 15:       using System.IO;
Line 16:       using System.Linq;
Line 17:       using System.Net;
Line 18:       using System.Web;
Line 19:       using System.Web.Helpers;
Line 20:       using System.Web.Security;
Line 21:       using System.Web.UI;
Line 22:       using System.Web.WebPages;
Line 23:       using System.Web.WebPages.Html;
Line 24:       using WebMatrix.Data;
Line 25:       using WebMatrix.WebData;
Line 26:       
Line 27:       
Line 28:       public class _Page_index_cshtml : System.Web.WebPages.WebPage {

首先,您的页面继承了 WebPages.WebPage - 这是怎么发生的?然后上面..注意到缺少 System.Web.Mvc 吗?这就是缺少“BeginForm”和“Partial”方法的错误的原因,因为它们都是 System.Web.Mvc 命名空间的一部分。以下是新的 MVC 3 项目输出对我的看法:

Line 12:   namespace ASP {
Line 13:       using System;
Line 14:       using System.Collections.Generic;
Line 15:       using System.IO;
Line 16:       using System.Linq;
Line 17:       using System.Net;
Line 18:       using System.Web;
Line 19:       using System.Web.Helpers;
Line 20:       using System.Web.Security;
Line 21:       using System.Web.UI;
Line 22:       using System.Web.WebPages;
Line 23:       using System.Web.Mvc;
Line 24:       using System.Web.Mvc.Ajax;
Line 25:       using System.Web.Mvc.Html;
Line 26:       using System.Web.Routing;
Line 27:       
Line 28:       
Line 29:       public class _Page_Views_Home_Index_cshtml : System.Web.Mvc.WebViewPage<dynamic> {

您上面列出的配置非常好。但是 /Views 中的配置会影响视图的生成,我最好的猜测是那里有问题。这是我注意到创建或破坏视图输出的一点(这里的命名空间直接反映在生成的代码中,类似于在 asp.net mvc 3 razor 中识别 html 助手的问题):

  <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>

此时,如果您还可以添加 ~/Views/Web.config 以防这不是问题,这似乎是一个好主意。

于 2012-08-27T15:27:45.207 回答
0

最终回到原来的服务提供商

于 2012-09-03T07:08:41.883 回答