2013-03-04 54 views
2

Local Environment { IIS 7.5 | Windows 7 | ASP.NET 4.0 | Integrated Pipeline}ASP.NET WEBAPI生產環境| 「系統找不到指定文件」

Production Environment {IIS 8.0 | Windows 2012 Server | ASP.NET 4.x | Integrated Pipeline}

的WebAPI的功能在本地環境中工作如

http://<domain>/api/towncity?startsWith=Marston

但在生產,我收到下面的 「遲鈍」 的錯誤消息。

{"Message":"An error has occurred.","ExceptionMessage":"The system cannot find the file specified","ExceptionType":"System.ComponentModel.Win32Exception","StackTrace":null}

任何改進錯誤的信息呢?或者你知道解決方案?

非常感謝,戴夫。

+1

查看服務器上的EventLog。它可能包含更多有用的信息。 – 2013-03-04 16:54:16

回答

1

好的,經過一番調查,發佈的RELEASE web.config沒有更新WEB.CONFIG實體連接字符串。

因此它使用實體連接字符串的本地設置。

<add name="YourDatabaseNameEntities" 
    connectionString=" 
      metadata=res://*/Model.YourDatabaseName.csdl|res://*/Model.YourDatabaseName.ssdl|res://*/Model.YourDatabaseName.msl; 
      provider=System.Data.SqlClient; 
      provider connection string=&quot; 
       data source=<set datasource here>; 
       initial catalog=<set catalog here>; 
       persist security info=True; 
       user id=<set user id here>; 
       password=<set password here>; 
       integrated security=False; 
       MultipleActiveResultSets=True; 
       App=EntityFramework&quot; 
    " 
    providerName="System.Data.EntityClient" /> 

我目前正在尋找Scott Hanselman的一部分,爲調試,發佈和生產設置不同的web.configs。

Tiny Happy Features

+0

嘿,我正面臨同樣的問題。你有沒有找到解決方案? – Bitsian 2013-03-21 09:31:54

+0

是的,解決方案如上所述。 可以在Visual Studio中配置Web Deploy以使用正確的生產實體連接字符串,或者爲生產創建新的生成配置以及相應的Web.Production.Config轉換以使用正確的生產實體連接字符串。 Tiny Happy特性文章解釋了自定義構建配置和web.config變換。 – 2013-03-21 15:53:25

+0

這實際上適用於我...我在轉換的Web配置中指定了錯誤的連接字符串名稱。哇 - 永遠不會想到我自己。 – 2013-04-02 15:33:40

相關問題