I am starting with ASP.NET MVC development just now, after some years of ASP.NET WebForms.
Following a simple tutorial, I developed an HelloWorld ASP.NET MVC web site and deployed to the FileSystem using Visual Studio 2012 deployment tool: no problem to access it from my IIS.
I tried then FTP deployment to my Internet Service Provider (I just FTP-copied the files and folders contained in the FileSystem deployment made by VisualStudio). If I try to access the same site hosted by the ISP I get the following error:
Exception Details: System.TypeAccessException: Attempt by method 'DynamicClass.CallSite.Target(System.Runtime.CompilerServices.Closure, System.Runtime.CompilerServices.CallSite, System.Object)' to access type 'System.Runtime.CompilerServices.CallSite`1<Microsoft.VisualBasic.CompilerServices.IDOUtils+SiteDelegate0>' failed.
Source Error:
Line 4:
Line 5: <h2>Indewx</h2>
Line 6: <div>#Me.ViewBag.Message</div>
Source File: D:\Inetpub\webs\pgsoftwareit\Views\Home\Index.vbhtml Line: 6
Any suggestion? Any params in the web.config to be tuned? Or problems with trust by the ISP?
Thank you in advance
Try
<div>#ViewBag.Message</div>
instead of
<div>#Me.ViewBag.Message</div>
Related
I developed an application in ASP.Net MVC 5 with database SQL Server 2012
now I want to deploy it in Windows Server 2012 with IIS 8
I followed this link: http://www.asp.net/mvc/overview/deployment/visual-studio-web-deployment/deploying-to-iis
but when I run my application in browser it gives error:
HTTP Error 500.19 - Internal Server Error The requested page can not
be access because the related configuration data for the page is
invalid.
I am new in this area please if you could explain in details.
You need to publish it first selecting your project on Visual studio . After that you need to create the site on IIS. In some case you can find diffiult on mapping your db for that you need to add the permission on the db server.
Verify if are installed the asp.net role in your server.
I hope this link can help you: https://technet.microsoft.com/en-us/library/hh831475.aspx
I would make sure that you have the latest .Net packages installed. I had a MVC5 app targeting 4.5.2 that would refuse to start.
I'm having a hard time configuring my server to host MVC4 application. Here's my situation:
I have Windows 2003 server SP2
Until now, all my hosted applications are targeted to .NET Framework 3.5, thus using ASP .NET 2. I use single web site to host web application
Now, I want to host very first application targeted to ASP .NET 4
What I did is:
I've installed .NET Framework 4
I've added new new application pool
I've added new virtual directory to my web site (the same web site that hosts ASP .NET 2 web apps) and converted it to web application. Next, I've selected ASP .NET version 4 on ASP .NET tab
So, I thought that it would be enough. But when I access my application with root url, the first thing I get is 403. I've checked security options and they seem to be all right.
Next, I tried to access one of my controller actions, eg:
http://servername/home/index
and now I get 404 error. Ok, so I've enabled browsing of files and I tried to access web.config, for to check what happens, and I received error:
Could not load file or assembly 'System.Core, Version=2.0.5.0,
Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or
one of its dependencies. The given assembly name or codebase was
invalid. (Exception from HRESULT: 0x80131047)
I've also run regiis command:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -s W3SVC/2049612577/root/cip-new/
but still in vain. Bottom line, it's something wrong, but I have not idea what is happening.
EDIT 1:
I've made some testing. What I did, is I'd created a basic MVC4 application from Basic template and simply published it to the server. And it worked. However when I published it to the server to the same directory, I got the error:
The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047).]
2 things I've had to do in the past to get v4 working on IIS6...
Make sure the site using .Net version 4.x runs in it's own app pool, separate to sites using .Net version 2.x
If you are using Razor I've noticed that IIS6 doesn't immediately know what to do. So you need to configure the Application Extensions Mappings. Add an extension mapping for .cshtml or .vbhtml depending on whether using C# or VB. I think that's why you're getting your 404 errors.
Restart IIS or recycle relevant app pools once above applied if you can to make sure changes are in effect.
I try to follow this link for migrate asp.net site to windows azure.After Convert to Web Application when I try to debug I got a following error.
Error 106 WAT070 : The referenced assembly path\Something.dll was not found. Please make sure to build the role project that produces this assembly before building this Windows Azure Cloud Service Project. C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\Windows Azure Tools\1.8\Microsoft.WindowsAzure.targets 1253 5 TestCloud
I try to add references from C:\Program...... but it is not work.What is mistake and how to resolve this error.Thanks.
I've got a Visual Studio 2010 MVC 3 Project that I'm trying to deploy using the Web Deploy Publish option from within Visual Studio. Whenever I try to deploy I get the following error:
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.
When I google the above error I find that people say to either configure the virtual directory as an application, or to check for nested web.config files.
The site runs fine when I deploy the project to it manually, so I believe the site is configured properly. I don't have an application below the site tho, as the site itself is set up as the application.
Also while MVC projects do have nested web.config files (one in the root and one in the views folder) renaming the views web.config file didn't fix the error.
Have you tried deleting your complied code in the obj folder and re-compiling?
I have created a reference to an IIS hosted WCF service in my ASP.NET website project on my local workstation through the "Add Service Reference" option in Visual Studio 2008. I was able to execute the service from my local workstation.
When I move the ASP.NET web site using the "Copy Web Site" feature in Visual Studio 2008 to the development server and browse to the page consuming the service, I get the following error:
Reference.svcmap: Specified argument
was out of the range of valid values.
Has anyone experienced this same error and know how to resolve it?
EDIT: My development server is Win2k3 with IIS 6
The problem may be due to a mismatch with the solution/project folder structure and the IIS web site folder structure. I ran into similar problems a good while ago and ended up changing how I deploy web services. Here and here are some discussions of similar problems to yours, they ended up not using the Add Service generated client and rolled their own client. Also, I can vouch for using the "Publish web site" method for deploying my services. Here is a good article on web service deployment models.
#Sixto Saez: I was able to use the following resource similar to the one you provided to generate a proxy class using the ServiceModel Metadata Utility Tool (svcutil.exe).
Here is the exact command line:
svcutil /t:code http://<service_url> /out:<file_name>.cs /config:<file_name>.config
Here is the reference I found that suggested using the method.
Also, I was able to consume the service by creating a reference using the Visual Studio 2008 "Add Web Reference" command. It generates code based on .NET Framework 2.0 Web Services technology.
Unforunately, the WCF service web site and I can not use the svcutil solution (Unless you know of a way how...). Do you deploy you service or your web site with the service reference using Visual Studio 2008 publish web site feature?