您使用的是basicHttpBinding嗎?並且是sl應用程序和svc在同一個域上?
我有(我認爲)一個類似的設置 - silverlight 3.0/wcf託管通過https使用窗體身份驗證。
我會複製我所有的相關配置,以防你失去了一些東西。
ServiceReferences.ClientConfig(不得不刪除了 '配置' 標籤,否則整個塊消失):
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_PassportService" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
textEncoding="utf-8">
<security mode="Transport">
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://domain/service.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_PassportService"
contract="PassportService.PassportService" name="BasicHttpBinding_PassportService" />
</client>
</system.serviceModel>
serviceModel在web.config中:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="ProjectPassport.Web.PassportServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpGetUrl="http://domain/service.svc" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="basicHttpsBinding">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service behaviorConfiguration="ProjectPassport.Web.PassportServiceBehavior"
name="ProjectPassport.Web.PassportService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpsBinding"
contract="ProjectPassport.Web.PassportService" />
</service>
</services>
</system.serviceModel>
和我的認證/授權/會員配置:
<authentication mode="Forms">
<forms loginUrl="Home.aspx" protection="All" timeout="80" name="AppName" path="/" requireSSL="false" slidingExpiration="true" defaultUrl="Manage.aspx" cookieless="UseCookies" enableCrossAppRedirects="false"/>
</authentication>
<authorization>
<deny users="?"/>
<!---->
<allow users="*"/>
</authorization>
<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15">
<providers>
<clear/>
<add name="SqlProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="LocalSqlServer" applicationName="MyApplication" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Clear" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="50" passwordStrengthRegularExpression=""/>
</providers>
</membership>
另外,別忘了js/clientBi應授權n/wcf服務地點。加入位置標籤:
<location path="ClientBin">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="service.svc">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
等等
編輯:鏈接你指的是針對的WinForms。如果我沒有弄錯,你正在構建silverlight 3應用程序。看看這些來代替:
http://msdn.microsoft.com/en-us/library/dd560704%28VS.95%29.aspx
http://www.eggheadcafe.com/tutorials/aspnet/7cc2760f-50f2-492d-9d62-48ad5c7f70b4/aspnet-membership-and-ro.aspx
來源
2010-03-25 13:23:12
kmk
能否請您發表您的web.config您的綁定節點。所以我們可以看到basicHttpBinding是如何配置的? - 謝謝 – DaveB 2010-03-26 16:38:42