简体   繁体   中英

Entity Framework not working on IIS?

I have an application running on IIS that i'm testing. Everything was fine until i publish it to the server. Server's ip address is 10.0.0.19 (this is a local application). Connection strings etc. everything is properly configured. Every other query in other pages are working fine but in some pages result sets aren't coming from Entity Framework.

Here is a sample code.

List<CCAP.Data.Orm.CustomerField> fieldList = CustomerFieldProvider.GetCustomerFieldList(projectId);
StringBuilder controlsToRender = new StringBuilder();
foreach (var item in fieldList)
{
    HtmlTagBuilder tagParaph = new HtmlTagBuilder("p");
    HtmlTagBuilder tagLabel = new HtmlTagBuilder("label");
    HtmlTagBuilder tagInput = new HtmlTagBuilder("input");
    tagInput.AddAttiribute("type","text");
    tagInput.AddAttiribute("style", "width :400px;");
    tagInput.AddAttiribute("name", item.FieldName);
    tagLabel.AddAttiribute("for",item.FieldName);
    tagLabel.SetInnerText(item.FieldHeaderText);
    tagParaph.AddChildElement(tagLabel);
    tagParaph.AddChildElement(tagInput);
    controlsToRender.Append(tagParaph.ToString());
}
return controlsToRender.ToString();

What can be wrong about this situation??

The differences when you publish it to IIS are:

  • Security context
  • Configuration file

In your case it is probably the security context. Does your connection string use a trusted connection? Does your app pool identity have access to your SQL server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM