asp.net mvc

Hi Guys ,

i have issue when i publish my project through asp.net mvc.

when I publish I publish to IIS i got error and I figured that when I publish I don't see the file "System.Web.Http.WebHost.dll" in been folder what actually cause the problem (I think:)).

Anyway I was trying to copy the file manually and it didn't help.
LVL 1
Moti Mashiah.NET DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ronak PatelCommented:
Hi,

Please post the exact error message or a screenshot of an error would be very helpful to identify the solution of the problem.

Regards,
Ronak
0
Lokesh B RDeveloperCommented:
Hi,

Follow the steps to fix the missing DLL issue on production.

1. Expand References in your project in visual studio
2. Right Click on the System.Web.Http.WebHost & click properties
3. Set Copy Local = true in the properties
4. Re Deploy, it should work fine
0
Moti Mashiah.NET DeveloperAuthor Commented:
Hi guys ,

Thanks for the answer.

I have tried Lokash's solution and now I'm getting this error after I publish to IIS(the dll "system.web.http.webhost.dll" is there now)

Capture.PNG

Here is my web.config file:
<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
    </sectionGroup>
  </configSections>
  <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=srv-db-02;Initial Catalog=ALThompsonCRM;Persist Security Info=True;User ID=sa;Password=45Tadabase;multipleactiveresultsets=True;" providerName="System.Data.SqlClient" />
    <add name="ALThompsonCRMEntities" connectionString="metadata=res://*/crmdb.csdl|res://*/crmdb.ssdl|res://*/crmdb.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=srv-db-02;initial catalog=ALThompsonCRM;persist security info=True;user id=sa;password=45Tadabase;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    <add name="rmsmasterdbtestEntities" connectionString="metadata=res://*/rmsdb.csdl|res://*/rmsdb.ssdl|res://*/rmsdb.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=srv-db-02;initial catalog=rmsmasterdbtest;persist security info=True;user id=sa;password=45Tadabase;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    <add name="RMSmasterHQEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=srv-db-02;initial catalog=RMSmasterHQ;persist security info=True;user id=sa;password=45Tadabase;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    <add name="VendorPrefixEntities" connectionString="metadata=res://*/Prefix.csdl|res://*/Prefix.ssdl|res://*/Prefix.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=srv-db-02;initial catalog=VendorPrefix;user id=sa;password=45Tadabase;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
  <system.net>
    <mailSettings>
      <smtp deliveryMethod="Network" from="systeminfo@althompson.com">
        <network host="172.16.1.6" userName="alt\\systeminfo" password="Alt@sys1" port="25" />
      </smtp>
    </mailSettings>
  </system.net>
  <appSettings>
    <add key="webpages:Version" value="2.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="enableSimpleMembership" value="false" />
    <add key="autoFormsAuthentication" value="false" />
    <add key="EmbedRequiredClientLibraries" value="true" />
    <add key="PreserveLoginUrl" value="true" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="docPath" value="D:\Source\ALThompsonCRM\ALThompsonCRM\Doc\Item_Pics\" />
    <add key="EmailTrigger" value="0" />
    <add key="ADLogin" value="0" />
    <add key="webUrl" value="http://localhost:1863/" />
    <add key="MailFrom" value="systeminfo@althompson.com" />
    <add key="MailPONotificationn" value="moti.mashiah@althompson.com" />
    <add key="MailDev" value="amol@althompson.com,chaz.hill@althompson.com,Moti.Mashiah@althompson.com" />
    <add key="poemail_template" value="E:\Codes\CRM1.0\ALThompsonCRM\templates\new_po_submitted_email.html" />
    <add key="webUrl" value="http://localhost:1863/" />
  </appSettings>
  <system.web>
    

    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login" timeout="2880" />
    </authentication>
    <roleManager defaultProvider="RoleHelper" enabled="true" cacheRolesInCookie="false">
      <providers>
        <clear />
        <add name="RoleHelper" type="ALThompsonCRM.Helper.RoleHelper" writeExceptionsToEventLog="false" />
      </providers>
    </roleManager>
    <pages>
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Optimization" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
        <add namespace="Shield.Mvc.UI" />
      </namespaces>
    </pages>
  </system.web>
  <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Optimization" />
        <add namespace="System.Web.Routing" />
        <add namespace="Shield.Mvc.UI" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" />
        <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" />
        <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
  </entityFramework>
</configuration>

Open in new window

0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Lokesh B RDeveloperCommented:
Hi,

Add the following tag to your web.config file.

<system.web>
    <customErrors mode="Off"></customErrors>
  </system.web>

Open in new window

0
Moti Mashiah.NET DeveloperAuthor Commented:
Hi,

Before your suggestion.

Now when I publish I'm getting this error. weird.
Capture.PNG
0
Lokesh B RDeveloperCommented:
Hi,

your project contains references to different versions of the same assembly  System.Web.Mvc

Just check them or add the tag to your web.config file under binding redirects.

Solution:

Double-click the warning and then select "Yes" when you get the prompt, "Do you want to fix these conflicts by adding binding redirect records in the app.config file?"

https://msdn.microsoft.com/en-us/library/bb383993.aspx
0
Moti Mashiah.NET DeveloperAuthor Commented:
I'm wondering how it happens.

Please, can you direct me how to do it.
0
Lokesh B RDeveloperCommented:
Hi,

1. Rebuild the project.

2. Double-click the warning

3. Select "Yes"
0
Moti Mashiah.NET DeveloperAuthor Commented:
OMG, now when i publish i don't get this error, but still when I publish on IIS get issue.

I'm sorry for the confusion, but it is really confusing me.

Here is the error after I publish to IIS.

"Could not load file or assembly 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"

There is any option to delete all the duplication manually?
0
Lokesh B RDeveloperCommented:
Hi,

Follow the steps here

1. Expand References in your project in visual studio
2. Right Click on the System.Web.Mvc & click properties
3. Set Copy Local = true in the properties
4. Re Deploy, it should work fine
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Moti Mashiah.NET DeveloperAuthor Commented:
Solved this issue with Lokesh's great help.

Steps to solve this issue.

1. Expend References in your project.
2. mark all your assembly.
3. Right click properties.
4.  Set copy Local=true in the properties.
5. Re Deploy,

P.S

I have to mention that I copied the "system.web.http.webhost.dll" from my backup project to this project as the version of this assembly went higher.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.