【发布时间】:2011-09-21 20:31:38
【问题描述】:
我有一个使用 Windows 身份验证的 ASP.NET MVC 应用程序。我希望该应用程序调用驻留在同一应用程序中的 WCF 服务。但是,我似乎无法为这个应用程序获取配置。 ASP.NET MVC 和 WCF 服务都驻留在同一个项目中。这是我到目前为止的配置:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<bindings>
<basicHttpBinding>
<binding>
<security mode="TransportCredentialOnly" >
<transport clientCredentialType="Windows" proxyCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="DashboardService">
<endpoint address="" binding="basicHttpBinding" contract="MyApplication.Services.ICustomService" />
</service>
</services>
<client>
<endpoint address="" binding="basicHttpBinding" contract="MyApplication.Services.ICustomService" />
</client>
</system.serviceModel>
我尝试在不同的 ASP.NET 应用程序中使用服务引用连接到 WCF 服务,该方法工作正常并且我可以返回正确的数据。
但是,使用此配置,当我访问 http://domain/myservice.svc/method 时,我收到 400, Bad Request。但是,http://domain/myservice.svc 和 http://domain/myservice.svc?wsdl 都可以正常工作。
似乎我忽略了 WCF 配置中的某些内容。
感谢您提供任何帮助。
【问题讨论】:
标签: jquery wcf iis wcf-binding windows-authentication