How to Setup SO-Aware to run on .Net 4.0

Steps

SO-Aware was created using the .Net 3.5 framework. To support WCF 4.0 we must tell the Web Server hosting SO-Aware to use ASP.Net 4.0, and tell ASP.NET to recompile the application using the.Net 4.0 assemblies. One of the nice features about ASP.NET is that it can dynamically recompile your web application upon startup. To set this up open IIS Manager and navigate to your Application pool that runs SO-Aware:

To do this Open IIS:

  1. First switch the application pool SO-Aware is running inside of to use .Net 4.0.

  2. Next install asp.net 4.0 into IIS if it’s not already done by navigating to a Command prompt as administrator navigate to this folder:
  3. C:\windows\Microsoft.NET\Framework64\v4.0.30128\
  4. Type in this line:

aspnet_regiis.exe -ir

  1. Lastly, change the web.config file to utilize the .Net 4.0 assemblies references by copying this web config file located below. (Remember to change the <connectionStrings> to point to the correct SQL Server or SQL Express databases, and the <appSettings>
    values to point to the correct SO-Aware ServiceRespository.svc and Tracking.svc urls:

<configuration>

<system.diagnostics>

<sharedListeners>

<add name=”EventLog” type=”System.Diagnostics.EventLogTraceListener” initializeData=”SO-Aware”>

</add>

</sharedListeners>

<sources>

<source name=”Tellago.ServiceModel.Governance.Monitoring” switchValue=”Warning, Error”>

<listeners>

<add name=”EventLog”/>

</listeners>

</source>

</sources>

</system.diagnostics>

<connectionStrings>

<add name=”ResourceRepositoryContext” connectionString=”metadata=res://*/ResourceRepository.csdl|res://*/ResourceRepository.ssdl|res://*/ResourceRepository.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.;Initial Catalog=ServiceRepository;Integrated Security=SSPI;MultipleActiveResultSets=True&quot;” providerName=”System.Data.EntityClient”/>

<add name=”TrackingEntities” connectionString=”metadata=res://*/TrackingModel.csdl|res://*/TrackingModel.ssdl|res://*/TrackingModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.;Initial Catalog=ServiceRepository;Integrated Security=SSPI;MultipleActiveResultSets=True&quot;” providerName=”System.Data.EntityClient”/>

</connectionStrings>

<appSettings>

<add key=”ResourceRepositoryUri” value=”http://localhost:8090/SO-Aware/ServiceRepository.svc“/>

<add key=”TrackingRepositoryUri” value=”http://localhost:8090/SO-Aware/TrackingData.svc“/>

<add key=”ChartImageHandler” value=”storage=memory;deleteAfterServicing=true;”/>

</appSettings>

<system.serviceModel>

<serviceHostingEnvironment aspNetCompatibilityEnabled=”true”/>

<services>

<service behaviorConfiguration=”tracking” name=”Tellago.ServiceModel.Governance.Monitoring.TrackingService”>

<endpoint address=”Tracking” binding=”netTcpBinding” bindingConfiguration=”tracking” contract=”Tellago.ServiceModel.Governance.Monitoring.ITrackingService”/>

</service>

<service name=”Tellago.ServiceModel.Governance.Monitoring.TrackingServiceWeb” behaviorConfiguration=”tracking”>

<endpoint address=”” binding=”webHttpBinding” bindingConfiguration=”trackingWeb” contract=”Tellago.ServiceModel.Governance.Monitoring.ITrackingServiceWeb” behaviorConfiguration=”trackingWeb”/>

</service>

</services>

<bindings>

<netTcpBinding>

<binding name=”tracking” maxBufferPoolSize=”524288″ maxBufferSize=”5242880″ maxReceivedMessageSize=”5242880″>

<readerQuotas maxStringContentLength=”5242880″/>

</binding>

</netTcpBinding>

<webHttpBinding>

<binding name=”trackingWeb” maxBufferPoolSize=”524288″ maxBufferSize=”5242880″ maxReceivedMessageSize=”5242880″>

<readerQuotas maxStringContentLength=”5242880″/>

<security mode=”TransportCredentialOnly”>

<transport clientCredentialType=”Windows”/>

</security>

</binding>

</webHttpBinding>

</bindings>

<behaviors>

<endpointBehaviors>

<behavior name=”trackingWeb”>

<webHttp/>

</behavior>

</endpointBehaviors>

<serviceBehaviors>

<behavior name=”tracking”>

<serviceThrottling maxConcurrentCalls=”16″ maxConcurrentSessions=”20″/>

<serviceMetadata httpGetEnabled=”false”/>

</behavior>

</serviceBehaviors>

</behaviors>

</system.serviceModel>

<system.web>

<!–

Set compilation debug=”true” to insert debugging

symbols into the compiled page. Because this

affects performance, set this value to true only

during development.

–>

<compilation debug=”true” targetFramework=”4.0″>

<assemblies>

<add assembly=”System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″/>

<add assembly=”System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″/>

<add assembly=”System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″/>

<add assembly=”System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089″/>

<add assembly=”System.Data.Services.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089″/>

<add assembly=”WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/></assemblies>

</compilation>

<!–

The <authentication> section enables configuration

of the security authentication mode used by

ASP.NET to identify an incoming user.

–>

<authentication mode=”Windows”/>

<identity impersonate=”true”/>

<authorization>

<deny users=”?”/>

</authorization>

<!–

The <customErrors> section enables configuration

of what to do if/when an unhandled error occurs

during the execution of a request. Specifically,

it enables developers to configure html error pages

to be displayed in place of a error stack trace.

<customErrors mode=”RemoteOnly” defaultRedirect=”GenericErrorPage.htm”>

<error statusCode=”403″ redirect=”NoAccess.htm” />

<error statusCode=”404″ redirect=”FileNotFound.htm” />

</customErrors>

–>

<pages controlRenderingCompatibilityVersion=”3.5″ clientIDMode=”AutoID”>

<controls>

<add tagPrefix=”asp” namespace=”System.Web.UI.DataVisualization.Charting” assembly=”System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>

</controls>

<namespaces>

<add namespace=”System.Web.Mvc”/>

<add namespace=”System.Web.Mvc.Ajax”/>

<add namespace=”System.Web.Mvc.Html”/>

<add namespace=”System.Web.Routing”/>

<add namespace=”System.Linq”/>

<add namespace=”System.Collections.Generic”/>

</namespaces>

</pages>

<httpHandlers>

<add path=”ChartImg.axd” verb=”GET,HEAD” type=”System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ validate=”false”/>

</httpHandlers>

</system.web>

<!–

The system.webServer section is required for running ASP.NET AJAX under Internet

Information Services 7.0. It is not necessary for previous version of IIS.

–>

<system.webServer>

<validation validateIntegratedModeConfiguration=”false”/>

<modules runAllManagedModulesForAllRequests=”true”>

</modules>

<handlers>

<remove name=”UrlRoutingHandler”/>

</handlers>

</system.webServer>

<runtime>

<assemblyBinding xmlns=”urn:schemas-microsoft-com:asm.v1″>

<dependentAssembly>

<assemblyIdentity name=”System.Web.Mvc” publicKeyToken=”31bf3856ad364e35″/>

<bindingRedirect oldVersion=”1.0.0.0″ newVersion=”2.0.0.0″/>

</dependentAssembly>

</assemblyBinding>

</runtime>

</configuration>

Once you’ve copied over this configuration file, recycle your IIS App Pool and restart your IIS Server. Open the SO-Aware web site, and verify everything works as planned.