又一次嘗試使用部署到IIS 7.5的basicHttpBinding獲取WCF Rest(no svc文件)服務失敗。我相信我的網站與IIS一起正確配置。我確定問題在於我的配置。我收到的迴應是500錯誤。我有一個MVC 3網絡在這個盒子上運行良好。WCF Rest with basicHttpBinding on IIS 7.5 500 error
WCF Rest服務正在使用basicHttpBinding和Transportcredentialonly的安全模式。這是我的配置;
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</modules>
<handlers>
<add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</handlers>
</system.webServer>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="AuthBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Basic"></transport>
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="NamedService">
<endpoint contract="Namespace.IService" binding="basicHttpBinding" bindingConfiguration="AuthBinding"></endpoint>
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" />
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>
當前Web和IIS配置基於其他職位;
- 我對網絡產生的V4.0應用程序池
- 我有一個網站創建了上面的應用程序池
- 我已經從32位和64位.NET V4 ISAPI篩選器啓用
- 相關我再次V4註冊-i的Aspnet_regiis.exe
- 我有HTTP重定向安裝
- 我有基本身份驗證啓用
任何幫助將不勝感激。我一直在這一天。順便說一句...我沒有看到任何事件消息。我知道DNS配置正確,因爲我可以剝離WCF的東西,並把一個臨時的HTML頁面在網絡上,它的工作原理。
---------------- UPDATE --------------------- 即使使用後仍然有問題剝離配置。我遺漏的幾件事是這是一個x64操作系統,我使用城堡作爲IoC。我確實運行了Frameword64/aspnet_regiis.exe。
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="castle" type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor"/>
</configSections>
<connectionStrings>
<add name="Main.ConnectionString" connectionString="data source=blah;initial catalog=newdatabase;User ID=web;Password=testing;persist security info=False;packet size=4096;" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation targetFramework="4.0" />
<httpModules>
<add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor" />
</httpModules>
</system.web>
<castle>
<properties>
<myConnStr>data source=blah;initial catalog=newdatabase;User ID=web;Password=testing;persist security info=False;packet size=4096;" providerName="System.Data.SqlClient</myConnStr>
</properties>
<components>
<component id="RestService" service="Namespace.Rest.IRestService, Namespace.Rest" type="Namespace.Rest.RestService, Namespace.Rest" lifestyle="PerWebRequest"/>
<component id="Repository" service="Namespace.Domain.Interfaces.IRepository, Namespace.Domain" type="Namespace.Domain.Repository, Thumbfound.Domain" lifestyle="PerWebRequest">
<parameters>
<connectionString>#{myConnStr}</connectionString>
</parameters>
</component>
</components>
</castle>
<system.webServer>
<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>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<standardEndpoints>
<webHttpEndpoint>
<!--
Configure the WCF REST service base address via the global.asax.cs file and the default endpoint
via the attributes on the <standardEndpoint> element below
-->
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true"/>
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>
</configuration>
yikes ...一天浪費在綁定上。謝謝! – vince 2011-02-15 06:01:39