MVC调用SVC无法找到资源解决问题

我们在.NET 4.0当中调用JS+WCF 一般都是这样做:

    <system.serviceModel>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" >
            <serviceActivations>
                <add relativeAddress="OrderGetService.svc" service="OrderGetService" factory="System.ServiceModel.Activation.WebScriptServiceHostFactory" />
            </serviceActivations>
        </serviceHostingEnvironment>
        <behaviors>
            <serviceBehaviors>
                <behavior>
                    <serviceMetadata httpGetEnabled="true"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>
    </system.serviceModel>

webconfig配置下就可以,但MVC当中老是报错 404 not found.
解决办法:

    routes.IgnoreRoute("{resource}.svc/{*pathInfo}");

这样就不会屏蔽MVC抱404 无法找到icontrol了

posted on 2013-04-01 11:19  ~紫鱼~  阅读(417)  评论(0编辑  收藏  举报