2013-12-17 26 views
0

我有一個aspx文件和配置文件中被認可......導入參考不運行時

<%@ Page Language="C#" Debug="true"%> 
<% 
    .... 
%> 

<?xml version="1.0"?> 
<configuration> 
    <appSettings> 
     .... 
    </appSettings> 
    <system.web> 
     <compilation debug="false" strict="false" explicit="true" /> 
     <pages> 
      <namespaces> 
       <clear/> 
       .... 
       <add namespace="OnTimeApi"/> 
       <add namespace="Newtonsoft.Json"/> 
      </namespaces> 
     </pages> 
    </system.web> 
</configuration> 

我就把這兩個文件中的空白VS解決方案,同時一個App_Data /文件夾,其中有OnTimeApi.dll和Newtonsoft.Json.dll。在VS中,它會識別這兩個dll文件,因爲語法正確突出顯示。當我運行使用IIS它,但是,它提供了以下錯誤:

Compiler Error Message: CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)

源錯誤:

Line 33:   <add namespace="System.Collections.Generic"/> 
Line 34:   <add namespace="OnTimeApi"/> 
Line 35:   <add namespace="Newtonsoft.Json"/> 
Line 36:  </namespaces> 
Line 37:  </pages> 

Source File: c:\inetpub\ontimeconnector\Web.config Line: 35

回答

0

確保你不只是在引用添加到App_Data文件夾,但也是該項目。右鍵單擊項目 - >添加引用,選擇這些DLL。這應該可以解決您的問題。

如果DLL未標記爲項目的引用,則它不一定會在編譯時將它們正確鏈接/複製到輸出,因此可能無法在運行時加載它們。

0

我找到了原因。這是iis經理的一個不正確的配置。我應該對這個問題更具體一些。