UrlRewriter.NET与.NET 4.0和GoDaddy的不工作工作、NET、UrlRewriter、GoDaddy

2023-09-04 00:18:16 作者:荒废的爱情、

我有一个已经UrlRewriter.NET安装和.NET 3.5本地和做工精细的we​​b项目Godaddy的共享主机。

I have a web project that had UrlRewriter.NET installed and working fine on .NET 3.5 locally and on Godaddy's shared hosting.

我则升级到.NET 4.0,这继续在Visual Studio 2010中工作,我的本地计算机上

I then upgraded it to .NET 4.0 and this continued to work on my local PC in Visual Studio 2010.

然后我升级到第四代托管,所以我能得到​​.NET 4.0。

Then I upgraded to the "4th generation hosting" so I could get .NET 4.0.

当我提出这个.NET 4.0项目的Godaddy的URL重写停止工作。

When I moved this .NET 4.0 project to Godaddy the url rewriting stopped working.

下面是我的web.config(浓缩为便于阅读,这里)

Here is my web.config (condensed for readability here)

<?xml version="1.0"?>
<configuration> 
   <configSections>
      <section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter"/>
   </configSections>

   <system.web>

   </system.web>
   <rewriter>
      <rewrite url="~/Neat-Url" to="~/Ugly-Url.aspx?id=1"/>
   </rewriter>
   <system.webServer>
       <validation validateIntegratedModeConfiguration="false"/>
       <modules runAllManagedModulesForAllRequests="true">
           <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule"/>
       </modules>
    </system.webServer>
</configuration>

当把Godaddy的服务器上,它只是返回一个404

When put on the Godaddy server it just returns a 404.

有趣的发现。如果我创建了一个名为/整齐-URL目录,URL重写重新开始工作,并重定向到/Ugly-Url.aspx?id=1

Interesting discovery. If I create a directory called /Neat-Url, the url rewriting starts working again and redirects to /Ugly-Url.aspx?id=1

请注意:是的,我知道,.NET 4.0中有它自己的URL重写,但我听说GoDaddy的没有安装模块,它(请纠正我,如果我错了),我也有现有的code,它的工作原理与UrlRewriter。

Note: Yes I realize that .NET 4.0 has it's own url rewriting, yet I heard that Godaddy has not installed the module for it (please correct me if I am wrong) and I also have existing code that works with UrlRewriter.

我也是注定的,因为它是一台服务器的配置问题还是有办法可以解决呢?

So am I doomed because it is a server configuration issue or is there a way I can work around it?

[更新]:好了,所以我已经确定了别的东西。该URL重写不会工作,除非文件或目录确实存在。

[UPDATE]: Ok so I have determined something else. The url rewriter won't work unless the file or directory actually exists.

例如。如果我想重定向/ directory1中,以/Directory1.aspx,/ directory1中必须存在,那么这一切工作正常。

For example. If I want to redirect /Directory1 to /Directory1.aspx, /Directory1 must exist, then it all works fine.

如果我想重定向/File1.aspx到/File2.aspx这也适用,但File1.aspx必须存在于文件系统上。

If I want to redirect /File1.aspx to /File2.aspx this also works but File1.aspx must exist on the file system.

否则,我不断地得到一个404。这通过.NET似乎可解的,并具有一些与web.config中做的呼吁File1.aspx被传递到运行时,并得到一个asp.net 404调用目录只得到一个虚拟主机404。

Otherwise I continue to get a 404. This seems solvable via .NET and has something to do with the web.config as calling upon File1.aspx gets passed to the runtime and gets an asp.net 404. Calling a directory just gets a web host 404.

[更新2]:我删除了

[UPDATE 2]: I removed the

<httpModules> 

这是我的web配置部分,然后添加

section from my web config, then added

<identity impersonate="false"/>

然后也发生了变化validateIntegratedModeConfiguration =真。在集成模式还是同样的问题,但至少可以确认了。

Then also changed validateIntegratedModeConfiguration="true". Still the same problem but at least is validates in Integrated Mode now.

[更新3]:我现在想ManagedFusion但仍运行到错误,但它似乎更喜欢在我的部分配置错误,而不是Godaddy的不支持它。我提出了另一个问题ManagedFusion URL重写不工作的Godaddy的第4代主机。

[UPDATE 3]: I am now trying ManagedFusion yet still running into errors, but it seems more like a configuration error on my part rather than Godaddy not supporting it. I raised another question ManagedFusion Url Rewriting not working on Godaddy 4th Generation Hosting.

希望这本书能解决我的问题。

Hopefully that will solve my problems.

推荐答案

变化重写模块的 URL重写模块。我有同样的问题与GoDaddy的,所以变化就解决了我的问题。

change rewrite module to Url Rewrite Module. I had same problem with Godaddy, so changing is solved my problem.