Microsoft.ReportViewer.Common gives "Access Is Denied" error - asp.net

Using .NET 4.0, I have a small ASP.NET app that utilized the ReportViewer object, I have created a web page that takes some user input and generates a report that is displayed using the ReportViewer control with ProcessingMode set to local.
Naturally, it works perfectly when run via VS 2010 in debugging mode and if I publish it to IIS running on my local machine. However, when I push it to production, I get the following error when actually trying to run the report
For the image impaired:
Failed to load expression host assembly. Details: Could not load file or assembly 'Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Access is denied.
I have verified that the assembly (as well as the other reportviewer dependencies) is in the GAC. There don't seem to be any errors in the event log on the server.
Any ideas what the permission problem might be?

What authentication are you using in IIS? (e.g. windows, anonymous, ASP.NET impersonation)

As it happens, the production environment I was deploying to is a web farm and the virtual directories point to a location on a network drive. When I tried deploying to a non farm server, with a virtual directory located on the server itself, this worked. The permissions are identical in the two environments, so I can only assume that something about this control didn't like being located on a different box than IIS and ASP.NET.
I'm not sure if this is actually an "answer", so apologies in advance if I've handled this wrong from a stackover perspective.

Related

Execute IIS .NET webforms website without precompiling the source code

I want to publish to IIS the source code of my website (visual studio 2017 web forms website in vb.net or c#) without pre-compiling the project, so I can modify the source code directly on the server with IIS.
I know this is possible, I have done it in the past, and I have seen it done even now, but I cannot figure out what I need to do for this.
When I copy all the website source code to the server with the IIS, the website does not run... any ideas? or where to look for an answer? Is it a matter of setup? of the type of project?
When I call the website I get the following error:
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: The CodeDom provider type
"Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider,
Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" could not be
located.
Source Error:
An application error occurred on the server. The current custom error
settings for this application prevent the details of the application
error from being viewed remotely (for security reasons). It could,
however, be viewed by browsers running on the local server machine.
Thanks!
#Gabe Thanks for the directions:
File - New Project, I see it under Visual Basic/Visual C# - Web - Previous Versions (ASP.NET Web Forms Site)
I tried it, and it works just fine! Basically if you create a project like you describe, you can just copy the source code in a server, without even installing visual studio there, and you can develop the site directly there.
This is ideal when you want to test things directly with external users, test things directly on the live or test servers, and of course you can make sure you have the source code of the project running, without having to keep both the source code and the compiled version.
There are a few drawbacks though:
1) you disrupt the website when you change things, and the application pool is restarted whenever there are changes, users in sessions are kicked out, etc...
2) there is a small delay while the site gets recompiled
3) there are cases where if while the code gets recompiled there are users online, there is asp.net corruption
Thanks for the replies!!
Regards
Manos

Umbraco 7 - moving site getting a Microsoft.IdentityModel Error when trying to login

I've developed a site using the Umbraco 7 CMS system, all works great and I've been able to copy and deploy this to numerous other machines and severs without any issues.
However now that we have tried deploying this to the live server, we are unable to login to the backend Umbraco section. The error is as follows:
Received an error from the server
Server call failed for getting current user
Could not load file or assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Access is denied.
Exception Details:
System.IO.FileLoadException: Could not load file or assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Access is denied.
The only different here is that the live server is administered by a Plesk control panel. So the actual site within IIS were created using this. However we have full Remote Desktop access and have set all the required "full control" permissions. And have checked that we have the correct .NET versions installed. But with no luck.
Has anyone experienced this or have a fix, I've searched Google and can't find anything that works.
Thanks
I haven't run into this myself, but it sounds like the server where you are trying to run your live site does not have the Windows Identity Foundation installed. I'd try installing that on your production server. Alternatively, you could find Microsoft.IdentityModel.dll reference in your solution right click it, open its properties and set Copy Local to true. That will cause the referenced dll to actually be dumped into the bin on compile. If you then deploy those dlls from the bin, your live site should be able to find them. You might have to go through that a couple of times until you find all of the Windows Identity Foundation dlls you need to get to.
It sounds like WIF has been integrated into the .NET 4.5 framework. It is depreciated and you shouldn't use it unless you are developing with .NET 3.5 or 4. I wouldn't expect you to be having this problem on .NET 4.5. What version of .NET framework are you using?
See What is Windows Identity Foundation for more info on WIF
Was any of that helpful?

Using SMO on web server with ASP.NET

Is it required to have anything SQL Server related installed on a web server in order to make use of SMO? I've built a web app that programmatically creates a SQL Agent job, adds a step (which ultimately fires of dtexec to run an SSIS package), and executes.
This works fine on my local machine which has SQL client tools installed, however when I move to a web server, I get reference issues and I'm starting to think it's due to something not being installed.
Could not load file or assembly 'Microsoft.SqlServer.SqlClrProvider, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies.
This is a rat hole.
The problem is that once you locate that assembly and copy it to the bin folder of your application it will complain about a completely different one.. or even the same file simply due to missing dependencies.
For more information read this: http://www.sqldbadiaries.com/2010/10/20/how-i-fixed-could-not-load-file-or-assembly-microsoft-sqlserver-smo-version10-0-0-0-issue/
That site lists the files you need and the fact you need to register and gac a few files. Quite frankly, you are much better off just biting the bullet and install the client tools on your web server.
Yes, your application requires this assembly in its bin directory to function. This error means that the server doesn't have the SMO (and its dependant) assemblies.
Back in your solution in Visual Studio, right click on the assembly above, and select/change the "Copy Local" to "True". Copy this for each SMO assembly that you've referenced.
When you publish your application, this will bring those .DLLs on your development machine along in your published bin directory.
Check your web.config file for any references as well
search your code for SqlClrProvider

Issues within an ASP.NET 2.0 Web Application to Look for When Running on Linux with Mono

My IT department and I are trying to get an ASP.NET web application to run on a Linux with Mono. We have been working on this for about a month to no avail. The Mono setup on the Linux server seems to be good. We are able to run the demo ASP.NET pages on the server and they work fine.
I developed my ASP.NET web application with Visual Studio 2008, and I recently downgraded the application to ASP.NET 2.0. Originally it was in ASP.NET 3.5, which might be the problem. After publishing the web app, I received the following files: Default.aspx, Web.config, bin (with a .dll and a .pdb file), and an empty App_Data file. So far, the error that keeps occuring is an appication error on the server.
For a simple test, I made a simple ASP.NET web app that had a label and a button. We tried that app and it did not work either. Does anyone know of things that I should look for within my ASP.NET web application that would inhibit the application to work?
Application error:
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a tag within a "web.config" configuration file located in the root directory of the current web application. this tag should then have its "mode" attribute set to "Off".
!--web.COnfig Configuration File--
configuration
system.web
customErros mode+"Off"/
/system.web
/configuration
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's configuration tag to point to a custom error page URL.
!--Web.Config Configuration File--
configuration
system.web
customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/
/system.web
/configuration
Thank you,
DFM
Just for a resolution, I finally figured out what the problem was. The ASP.NET web app has an onload event that enables the web app to read an Access Db. For testing purposes, I did not update the ADO.NET Db path for the web app to read the Db so every time it was loaded through Mono, the generalized error in question would occur. After deleting the onload event, the web app functioned perfectly. Additionally, I had to downgrade the web app to ASP.NET 2.0, instead of 3.5, and delete the LINQ namespaces, which were not being used.
All I have to do is change the path(s) to point to the App_Data folder and place the Db in the folder, as well.

System.Security.SecurityException thrown by ASP.NET application

Trying to get an ASP application deployed; it worked for a while but then started coming up with errors whenever the page is accessed:
Server Error in '/AppNameHere' Application.
Security Exception Description: The application attempted to perform
an operation not allowed by the security policy. To grant this
application the required permission please contact your system
administrator or change the application's trust level in the
configuration file.
Exception Details: System.Security.SecurityException: Request for the
permission of type 'System.Web.AspNetHostingPermission, System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
failed.
An IISreset didn't change anything, but rebooting the entire system got it to work for a few hours before the problem came back. The .config for the application is set to full trust.
What could be causing this, and how can it be fixed? (Or, if more information is needed, where do I go looking to find it)
Found the following on Jason Gaylord's blog:
System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005
I rebuilt one of my development machines recently and attempted to access a project that I had out on a network share. I continually received project messages about the project not being trusted. I remembered that I had to change something but couldn't remember what it was until I found an old note I left in Outlook.
The message I would receive in Visual Studio 2005 was: ASP.NET runtime error: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
To resolve this issue, you must change your development machine .net security configuration since you are accessing items across the network. In the event that you need this ability at runtime, you must change the trust level in your config file to full. However, since this is only in development,
I can change my local PC's security
by going to Start > Control Panel >
Administrative Tools > Microsoft
.NET Framework 2.0 Configuration.
After it fully loads (sometimes
takes a bit), fully expand My
Computer in the navigation tree and
click Runtime Security Policy.
In the right hand pane, choose
Adjust Zone Security. Leave the
default option (Make changes to this
computer) and hit next.
Choose Local Intranet and change the
trust level to Full Trust. Then
choose next and then finish.
Restart Visual Studio 2005 and you
should be all set.
This worked for me ... so hopefully this will work for you!

Resources