WCF接管控制器/操作URL创建?

时间:2017-07-18 11:37:18

标签: c# asp.net-mvc wcf

我创建了一个MVC5站点,它也托管了一个WCF API。使用其他博客建议我创建了这些路线:

routes.Add(new ServiceRoute("AuthZ", new ServiceHostFactory(), typeof(AuthZ)));

routes.MapRoute(
    name: "Default",
    url: "{controller}/{action}",
    defaults: new { controller = "Home", action = "Index" }
);

所以在我的表单/视图中,现在我有了这段代码:

@using (Html.BeginForm("Authenticate", "Login"))
{
....

但不是指向/Login/Authenticate的表单实际上是这样的:

<form action="/AuthZ?action=Authenticate&amp;controller=Login" method="post">
...

在所有Html.ActionLink和其他动态生成网址的方法中也会发生这种情况。当我删除AuthZ路线时,它开始正常工作。对这项技术的帮助和支持是如此之低,我实际上甚至不知道在这一点上尝试什么。有什么建议?

注意,如果它有任何重要性,这是web.config中的服务配置:

<system.serviceModel>
    <bindings>
        <wsHttpBinding>
            <binding name="AuthZBindingConfiguration">
                <security mode="None" />
            </binding>
        </wsHttpBinding>
    </bindings>
    <services>
        <service behaviorConfiguration="MetadataBehavior" name="soap.AuthZ">
            <endpoint address="/AuthZ" binding="wsHttpBinding" bindingConfiguration="AuthZBindingConfiguration" name="MainWSBinding" contract="soap.IAuthZ" />
        </service>
    </services>
    <behaviors>
        <serviceBehaviors>
            <behavior name="MetadataBehavior">
                <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
                <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>

0 个答案:

没有答案