HTTP错误404.0 - 在IIS服务器上找不到wcf路由

时间:2012-08-15 08:27:01

标签: asp.net wcf iis .net-4.0 iis-7.5

我在WCF项目中有以下提到的设置但是当我在IIS服务器中部署它时,当我尝试访问我的网站时出现404错误:http://mysite.com/MyService Global.asax中:

public class Global : System.Web.HttpApplication
{

    protected void Application_Start(object sender, EventArgs e)
    {
        RouteTable.Routes.Add(new ServiceRoute("MyService", new AppServiceHostFactory(), typeof(UserService)));
    }

MyService.cs:

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]

public class MyService : IMyService
{

的Web.config:

<system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules runAllManagedModulesForAllRequests="true">
        <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </modules>
</system.webServer>

<system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior name="">
                <serviceMetadata httpGetEnabled="true" />
                <serviceDebug includeExceptionDetailInFaults="false" />
                               </behavior>
        </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"
                               aspNetCompatibilityEnabled="true"/>
</system.serviceModel>

0 个答案:

没有答案