2010-06-21 135 views
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> 
+2

你需要的设置是“SHOW_FULL_EXCEPTION”和“POST_THE_CODE” – 2010-06-21 01:28:18

+0

在一个侧面说明,我不能工作,如何调试它(所以我不能得到充分的例外,而且FaultException异常不工作......),因为当我改变VS使用IIS而不是卡西尼时,那么我得到错误“Internet Explorer无法显示网页” – 2010-06-21 01:54:45

+0

这里有一个想法:停止吃异常。完全摆脱try/catch块。这样,它可能会记录在Windows事件日志中。如果没有,请打开WCF跟踪并重试。它_will_将在WCF日志中。 – 2010-06-21 05:19:17

回答

0

我想原因是以下行的web.config:

<identity impersonate="true"/> 

你应该将其更改为

<identity impersonate="false"/>