Crystal Reports charts not showing in visual studio 2010 - visual-studio-2010

I have a project with crystal reports version 13 that I am running as part of an MVC 3 .NET application.
We have 4 existing detail reports that work correctly.
The problem is that I need to create a new report that has charts, and I cannot get the charts to display at runtime, although they will display OK at design time.
This is running locally in visual studio (not in iis).
The problem appears to be because crystal reports generates a file dynamically called crystalimagehandler.aspx, and for whatever reason this isn't being generated on my computer
When I run process monitor as thereport is being generated, it produces the following output:
10:01:40.1814627 a.m. WebDev.WebServer40.exe 1692 QueryOpen D:\tfs\chad\Main>\Src\chad\Chad.Website\Reports\CrystalImageHandler.aspx NAME NOT FOUND
I have added the following lines to my web.config
<httpHandlers>
<add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
</httpHandlers>
(and in system.webServer)
<handlers>
<add name="CrystalImageHandler.aspx_GET" path="CrystalImageHandler.aspx" verb="GET" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" preCondition="integratedMode" />
</handlers>
Does anyone have any other suggestions?

The problem was that because this is an MVC Application, I had to tell it to ignore the route to the reports folder. I found the solution in this thread Embedded images not displayed in MVC application
I added the line:
routes.IgnoreRoute("Reports/{*restOfUrl}");
to my Global.asax, and that did the trick.
Note that the web.config setting to add the httpHandler is also a necessary pre-condition for getting the images to display.

Related

EntityFramework / WCF RIA Services / Oracle / Custom number mapping

this post is intended as (not optimal) solution for everyone that has to struggle with the same problem and there is only few to no answer in the net atm...
(of cousrse this post will contain information from other sources)
we had problems with custom data type mapping (number) in our project (VS2010/EntityFramework/WCF RIA Services/Oracle ODP.NET) which we were able to solve the following way:
we had to use the following custom oracle number mapping information (because of legacy DB)
</connectionStrings>
<oracle.dataaccess.client>
<settings>
<add name="int16" value="edmmapping number(4,0)" />
<add name="int32" value="edmmapping number(9,0)" />
<add name="int64" value="edmmapping number(17,0)" />
</settings>
</oracle.dataaccess.client>
we put this information in App.Config within the project with the EDMX file(s)
now we were able to create our EDMX files with the custom mapping
1) there was a problem that when you restart VS2010 it can happen that upon proeject compilation it wont compile because of an Error 2019, this error is of course related to our custom mapping and its a "VS2010 bug???" maybe but one solution is to open he VS2010 about window then close it then compile... but the better solution might or might not be to add the same information we added to the App.Config file to the devenv.exe.config file...
now we can compile the EDMX project and
the My.Service.Web (.NET) project that uses the our EDM
2) there is still another problem ... the WCF RIA Service My.Service (SL5) project
has no idea of the App.Config settings so when we try to compile it we will also get the
Error 2019...
adding the mapping information to the Web.Config file did not help
but when we add it to the machine.config file we can finally compile...
SUMMARY: add the mapping information to
App.Config (where your edmx file is)
Machine.Config (C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config)
Web.Config (in your web project, not sure if required since we added it to Machine.config)
QUESTION: isn't there a better solution than to add it to Machine.Config?
I really hope someone has a better one because it will probably restict
development of other projects...
hope this helps and hope for a better (re)solution
thx and cheers
versions:
VS2010 SP1
EntityFramework 4.1
WCF RIA Services 1 SP2
Oracle 11g (ODAC/ODP.NET 11.2.0.3.0)

mvc3 view cannot load namespace(How do views reference dlls)

I updated the dll references in my mvc3 site. they are the same dlls but different versions. I did this by first deleting them, then added the updated ones. All compiles properly. However at runtime, I get runtime errors of cshtml files not being able to reference some namespaces. When I open these cshtml files, the vs2010 does show an error of undefined namespaces. BUT the same namespaces work fine in codebehind cs files. In the respective view web.config file. I have tried:
<namespaces>
...
<add namespace="myassembly" />
</namespaces>
or
<controls>
<add assembly="myassembly, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="myassembly" tagPrefix="myassembly" />
</controls>
I still can't rectify the problem in my view. When I revert to old dlls version, EVERYTHING works fine and I don't need modification in view web.config. It seems like its a case of the view still trying to reference the old dll version, hence it can't find them when I update to new versions.
How do views reference dlls?
Thanks
You have to use the web.config file that is inside the Views folder, not the one that is in the root directory of your project.

An MVC3 project is looking for 'System.Web.Mvc, Version=1.0.0.0,

I'm deploying an MVC3 project that began life in the old days of xVal. I think that's the root of this error:
Could not load file or assembly 'System.Web.Mvc, Version=1.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)
I have the same webapp running correctly on the production server - a win08 (pre-R2) box that served the v1 version of the app. Now I'm moving to a newly provisioned R2 box and find that any page referencing xVal is tossing the above error.
Is there a way to transfer the older dll(s) without digging thru the asp.net/mvc site for an old distro? I'd really like to avoid touching any bits of the validation system right now.
thx
ADDENDUM: Initially the pointer to Phil Haack's post seemed to solve my problem - but re-deployed today and having the same issue with this additional info.
I'm using ELMAH to log the app's errors and the source being reported to ELMAH might offer a clue. Instead of the SOURCE property being something like 'NHIBERNATE' or 'SYSTEM' or my assembly's name i'm seeing 'App_Web_b1pe5vbs'. The log has a handful of these oddly named Sources. Any thing to see here?
thx
in vs2010 you could now right click on the MVC3 project, click on "Add Deployable Dependencies" and select ASP.net MVC checkbox, it will add required assemblies in _bin_deployableAssemblies folder.

How to make DevServer put all assemblies in one folder?

I need to config IIS-Express (or DevServer) to put all output assembly files in one place.
Now DevServer copies each dll to its own folder like:
C:\Users\UserName\AppData\Local\Temp\Temporary ASP.NET Files\root\3df2e06f\587c7c63\assembly\dl3\fea77c7a\42e614aee75dcc01"
I need this to enumerate assemblies, and load plugins.
Three month ago I managed to find special key to app.config, which helped.
Does enyone know this magic app.config key?
Finally found:
<system.web>
<hostingEnvironment shadowCopyBinAssemblies="false" />
</system.web>

MVC3 Strange error after switching on compilation of views

I am currently working on a MVC3 project with Razor.
I have switchen on compilation of Views to be aware of spelling errors etc. at compile-time.
As soon as I switch on the <MvcBuildViews>true</MvcBuildViews> in the projects configuration file a get the following error during compile:
Error 1 It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
I read several possible solutions to the problem, mostly concerning IIS and virtual Directories or Applications.
The problem is, that I do not use IIS, but instead use the default Visual Studio Development Server.
What can I do to solve this problem?
I have tried a lot of different solutions available in the web, but either they did not quite fit onto my problem, or they did not work.
To recap my problem:
After switching CompileViews on, I immediately got the above error during compile.
I am using the default Visual Studio Development Server of VS2010 to test my MVC app.
Today I opened a request at Microsoft Developer support, and - I am almost ashamed to admit it - got my answer approximately 30 seconds into the callback from the technician:
All he said was: Please goto your obj folder and delete all contents. Then compile again.
And that really was all it took.
So after a lot of head-shaking about myself I wanted to share the results with you.
This problem occurs when there is web project output (templated web.config or temporary publish files) in the obj folder. The ASP.NET compiler used isn't smart enough to ignore stuff in the obj folder, so it throws errors instead.
Another fix is to nuke the publish output right before calling <AspNetCompiler>. Open your .csproj and change this:
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
</Target>
to this:
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<ItemGroup>
<ExtraWebConfigs Include="$(BaseIntermediateOutputPath)\**\web.config" />
<ExtraPackageTmp Include="$([System.IO.Directory]::GetDirectories("$(BaseIntermediateOutputPath)", "PackageTmp", System.IO.SearchOption.AllDirectories))" />
</ItemGroup>
<Delete Files="#(ExtraWebConfigs)" />
<RemoveDir Directories="#(ExtraPackageTmp)" />
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
</Target>
That will delete all web.configs under \obj, as well as all PackageTmp folders under \obj.

Resources