Azure Web App URL重写无法正常工作

时间:2016-09-16 09:30:15

标签: iis azure-web-sites

我试图获得基本的网址重写,以便为我的Azure网络应用

工作
<system.webServer>
    <rewrite>
        <rules>
            <rule name="SalesCloudGmail" stopProcessing="true">
                <match url="/SalesCloudGmail.aspx" />
                <action type="Redirect" url="/SalesCloudGmail" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>

期待打开URL ... / SalesCloudGmail.aspx并在地址栏中看到... / SalesCloudGmail ???

我缺少什么

2 个答案:

答案 0 :(得分:0)

请尝试以下重写规则:

<rewrite>
      <rules>
        <rule name="SalesCloudGmail" stopProcessing="true">
         <match url="^\/SalesCloudGmail\.aspx$" />
          <action type="Redirect" url="/SalesCloudGmail" />
        </rule>
      </rules>
    </rewrite>

请按照this article来测试您的匹配模式。

答案 1 :(得分:0)

尝试一下,根据你使用它的方式,你的正则表达式模式匹配有点偏差。但这应该起作用或者至少让你更接近。

public class Polygon {

private int numSides; //number of sides
private double sideLength; //length of each side
private double xCoord; //x-coordinate of th center of the polygon
private double yCoord;//the y-coordinate
private double apothem;//defines the apothem
private double perimeter;

/**
 * no argument constructor
 */
public Polygon() {
    this.numSides = 4;
    this.sideLength = 10.0;
    this.xCoord = 0.0;
    this.yCoord = 0.0;
    this.apothem = 5.0;
    this.perimeter = 20.0;
}

/**
 * constructor that takes arguments
 *
 * @param _numSides :-number of sides
 * @param _sideLength :-the length of each side
 * @param _xCoord :-the x coordinate
 * @param _yCoord :-the Y coordinate
 * @param _apothem :-the apothem
 */
public Polygon(int _numSides, double _sideLength, double _xCoord, double _yCoord, double _apothem) {

    this.numSides = _numSides;
    this.sideLength = _sideLength;
    this.xCoord = _xCoord;
    this.yCoord = _yCoord;
    this.apothem = _apothem;

}

/**
 *
 * @return area of the polygon[double]
 */
public double getArea() {
    perimeter = numSides * sideLength;
    double area = (0.5) * apothem * perimeter;
    return area;

}
//getter & setters

public int getNumSides() {
    return numSides;
}

public void setNumSides(int numSides) {
    this.numSides = numSides;
}

public double getSideLength() {
    return sideLength;
}

public void setSideLength(double sideLength) {
    this.sideLength = sideLength;
}

public double getxCoord() {
    return xCoord;
}

public void setxCoord(double xCoord) {
    this.xCoord = xCoord;
}

public double getyCoord() {
    return yCoord;
}

public void setyCoord(double yCoord) {
    this.yCoord = yCoord;
}

public double getApothem() {
    return apothem;
}

public void setApothem(double apothem) {
    this.apothem = apothem;
}

public double getPerimeter() {
    return perimeter;
}

public void setPerimeter(double perimeter) {
    this.perimeter = perimeter;
}

//to string method
@Override
public String toString() {
    return "Polygon definitions[" + "number of sides=" + numSides + ", Each side length=" + sideLength + ", xCoord=" + xCoord + ", yCoord=" + yCoord + ", apothem=" + apothem + ']';
}