ASP.NET WEBAPI生产环境| “该系统找不到指定的文件”

时间:2013-03-04 16:28:02

标签: asp.net-web-api

Local Environment { IIS 7.5 | Windows 7 | ASP.NET 4.0 | Integrated Pipeline}

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 个答案:

答案 0 :(得分: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关于为DEBUG,RELEASE和PRODUCTION设置不同web.configs的文章。

Tiny Happy Features