1
我正在嘗試使用IIS託管WCF服務(在Cassini中正常工作)。但是,當我在IIS中託管它時,出現以下錯誤:在IIS上託管WCF服務
「與服務器建立了連接,但在登錄過程中發生錯誤(提供程序:共享內存提供程序,錯誤:0 - 沒有進程)「
我認爲這可能是由於IIS和Windows身份驗證,所以我改變了連接字符串直接用uid和密碼登錄數據庫,沒有什麼區別。我不認爲我得到那麼多,因爲如果是這樣的話,我會期望sql安全性錯誤。
我已經建立了一個全新的服務器(2008年),我仍然得到同樣的問題...
什麼設置,我需要實現得到這個打算?
例WCF代碼
private GenericDataClassesDataContext _db = new GenericDataClassesDataContext();
public ReferenceValue[] GetReferenceValues()
{
try
{
return _db.ReferenceValues.ToArray();
}
catch (Exception e)
{
throw new FaultException(e.Message);
}
}
的Web.Config
<?xml version="1.0"?>
<configuration>
<appSettings/>
<connectionStrings>
<!--<add name="TtasConnectionString" connectionString="Data Source=stdev07;Initial Catalog=Ttas;;uid=srvTtas;pwd=pa$$w0rd;MultipleActiveResultSets=True" providerName="System.Data.SqlClient"/>-->
<add name="TTASConnectionString" connectionString="Data Source=STDEV07;Initial Catalog=IRF;Integrated Security=SSPI" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0">
</compilation>
<authentication mode="Windows"/>
<identity impersonate="true"/>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web>
<system.serviceModel>
<extensions>
<behaviorExtensions>
<add name="silverlightFaults" type="Moe.Tactical.GenericData.Wcf.SilverlightFaultBehavior, Moe.Tactical.GenericData.Wcf, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</behaviorExtensions>
</extensions>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<behaviors>
<endpointBehaviors>
<behavior name="SilverlightFaultBehavior">
<silverlightFaults />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="Moe.Tactical.GenericData.Wcf.GenericDataServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<!--<serviceDebug includeExceptionDetailInFaults="false" />-->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="winAuthBasicHttpBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="Moe.Tactical.GenericData.Wcf.GenericDataServiceBehavior" name="Moe.Tactical.GenericData.Wcf.GenericDataService">
<!--bindingConfiguration="winAuthBasicHttpBinding" [in gap]-->
<endpoint address=""
binding="basicHttpBinding"
behaviorConfiguration="SilverlightFaultBehavior"
contract="Moe.Tactical.GenericData.Wcf.IGenericDataService">
<identity>
<dns value="localhost:3637"/>
</identity>
</endpoint>
<!--<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>-->
</service>
</services>
</system.serviceModel>
</configuration>
你需要的設置是「SHOW_FULL_EXCEPTION」和「POST_THE_CODE」 – 2010-06-21 01:28:18
在一個側面說明,我不能工作,如何調試它(所以我不能得到充分的例外,而且FaultException異常不工作......),因爲當我改變VS使用IIS而不是卡西尼時,那麼我得到錯誤「Internet Explorer無法顯示網頁」 – 2010-06-21 01:54:45
這裏有一個想法:停止吃異常。完全擺脫try/catch塊。這樣,它可能會記錄在Windows事件日誌中。如果沒有,請打開WCF跟蹤並重試。它_will_將在WCF日誌中。 – 2010-06-21 05:19:17