重定向有效,但重写不在Azure Web应用程序上

时间:2015-09-07 08:57:47

标签: azure iis azure-web-sites

我正在尝试从旧ISP重定向到我的Azure网站。我已经设置了必要的DNS记录。当我在Web App上使用子文件夹时,我需要在root web.config文件中设置重定向规则,以便从域名指向主站点的正确子文件夹。

当我有重定向规则时,它可以正常工作。

            <rule name="Fails" stopProcessing="true">
                <match url=".*" />
                <conditions>
                    <add input="{HTTP_HOST}" pattern="^mysite.com$" />
                </conditions>
                <action type="Rewrite" url="http://mysite.azurewebsites.net/mysub"/>
            </rule>              

然而,当我改为Rewrite时,它失败了。我真的想要重写,因为我不希望用户在浏览器中看到url的更改。

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

我收到以下消息:

unsafe
{
    IntPtr pixels = Marshal.AllocHGlobal(8);

    Marshal.WriteByte(pixels, 0 * Marshal.SizeOf(typeof(Byte)), 0);
    Marshal.WriteByte(pixels, 1 * Marshal.SizeOf(typeof(Byte)), 255);
    Marshal.WriteByte(pixels, 2 * Marshal.SizeOf(typeof(Byte)), 0);
    Marshal.WriteByte(pixels, 3 * Marshal.SizeOf(typeof(Byte)), 255);

    Marshal.WriteByte(pixels, 4 * Marshal.SizeOf(typeof(Byte)), 0);
    Marshal.WriteByte(pixels, 5 * Marshal.SizeOf(typeof(Byte)), 0);
    Marshal.WriteByte(pixels, 6 * Marshal.SizeOf(typeof(Byte)), 0);
    Marshal.WriteByte(pixels, 7 * Marshal.SizeOf(typeof(Byte)), 0);

    var newImage = new UnmanagedImage(pixels, 2, 4, 1, System.Drawing.Imaging.PixelFormat.Format8bppIndexed);
    var myBM = newImage.ToManagedImage();
    myBM.Save("outputBM.bmp", System.Drawing.Imaging.ImageFormat.Bmp);

    Marshal.FreeHGlobal(pixels);
}

我做错了什么?

1 个答案:

答案 0 :(得分:1)

您的重写操作应该是相对路径,请参阅文档:

http://www.iis.net/learn/extensions/url-rewrite-module/url-rewrite-module-configuration-reference#Rewrite_action

def reduce(accumulator: Seq[MyType], original: Seq[MyType]): Seq[MyType] = original match { case Nil => accumulator case head :: xs => { val found = xs.find(_.timeSpan.getStart().equals(head.timeSpan.getEnd)) if (found.isDefined && found.get.value == head.value) { reduce( accumulator :+ (MyType(new Interval(head.timeSpan.getStart, found.get.timeSpan.getEnd), head.value)), original.diff(Seq(found.get, head)) ) } else reduce( accumulator :+ head, xs ) } }