How to do a precompiled web application - c#

I have a webapplication that uses a master page. When I publish the site in vs2010 (running framework 4), and then I navigate to the default.aspx page I get a parser error that the masterpage's codebehind file does not exist.
I know that a website can be precompiled and then deployed which means there would never be anything that IIS needs to parse. The above error therefore implies that IIS is still trying to compile my precompiled site.
Is there something that needs to be configured to stop the web application from doing this?

Convert to Web Application: Difference between 'Web Site' and 'Project' in Visual Studio

Have you uploaded the bin folder with the webapplication's dll?

You are using the term 'web application' and 'website' interchangeably in your question.
If you are using the web application model, you need to build it before deployment (i.e to a single binary)
If you are using the website model, you need to deploy all your files (code behind included), the framework then JIT compiles all your codebehind.
But you can pre-compile:
http://msdn.microsoft.com/en-us/library/ms227972.aspx

Related

Installing an ASP.NET web API on IIS

I have built my first ASP.NET web API in MVC, when I debug the application from Visual Studio everything works perfectly.
Now I need to get these API's on my server...
I have tried copying the project files to the website root which usually works for normal MVC apps with views, and I have also built the project and copies the file full of DLL's and an exe to the IIS root.
Obviously, neither of these worked, anyone know what I am missing? Perhaps something I have to do with IIS?
I have now tried "publishing" the project and when I try to access the site this happens...
Thanks in advance!
Build the application then publish it. Copy the published files to a favorite IIS folder. Ensure you select the right version of ASP.NET in the server for your application in the application pool.
When you publish and get an error such as this it is often related to a configuration issue, or other non-supported .NET Runtime issue.
For best results, if you can get to the Event Viewer for the server a detailed error should appear there outlining the root cause of the issue.
If you don't have access to the server directly, updating the <system.webServer> section with the below should get you a detailed error.
<httpErrors errorMode="Detailed" />
Just please note DO NOT LEAVE THAT LINE IN PRODUCTION!

Visual Studio 2013 web forms project (.NET 4.5 and above) fails when deployed to hosting service. Runs locally

I've recently been working with ASP.NET again and decided to create a small ASP.NET project in a subfolder on one of my websites. I'm using Visual Studio 2013 and created the project using the ASP.NET Web Forms Application template. After creating the project, I left everything at the default, verified that it would build locally, published it to a folder on my system and then copied the published files via FTP to the subfolder on my site. When I tried to bring it up in my browser, it failed with the code ERR_CONNECTION_RESET. This told me that the host was seeing something there, otherwise it would have gone to my site's main 404 page. Chrome also refused to load the other pages within the deployed template. I did set the folder as an application in IIS after getting another error about forms authentication but that didn't have any effect.
I was able to successfully re-deploy an old ASP.NET site created with .NET 4.0 in VS2010. I was also able to deploy and load a project created in VS2013 / ASP.NET 4.5.1 with the ASP.NET Empty Web Application template.
I finally finally get the Web Forms template to work by doing the following -
Created a basic Default.aspx page with no master page.
Created a basic web.config file (copied from another new empty
project)
Commented out the following lines in the Application_Start function of Global.asax
BundleConfig.RegisterBundles(BundleTable.Bundles);
AuthConfig.RegisterOpenAuth();
RouteConfig.RegisterRoutes(RouteTable.Routes);
At that point, the project ran on the host with no problem. I then restored the Default.aspx and Web.config files and the project again failed, even with the Global.asax lines still commented.
I also changed the SessionState mode to "Custom" as suggested in the web.config file and this made no difference.
My question at this point is this - Has anyone else deployed a .NET 4.5.1 Web Forms app designed from the VS2013 template to a shared hosting service and is there something that you have to do to get it to work?
I'm fairly satisfied at this point that I can use the empty web application template and build things from scratch but I'd like to know if anyone else has run into this and what they did.
Thanks.
ERR_CONNECTION_RESET sounds to me like you were having some kind of Internet connectivity troubles, or your server was having some sort of Internet connectivity trouble. If it's working fine now, probably nothing to worry about.
Has anyone else deployed a .NET 4.5.1 Web Forms app designed from the VS2013 template to a shared hosting service and is there something that you have to do to get it to work? Yes, lots of people have done that.

Starting a ASP.NET restful webservice on IIS

I have developed a restful web service using ASP.NET, and while using the Visual Studio environment, it worked like a charm with IIS Express. The service itself is a complementary feature and will have to run on every machine on which our product is installed.
I have therefore created a new directory webservice, which holds the web.config and the Global.asax file, as well as a directory bin, which holds the RestulWebservice.dll file.
I then have setup a new web page on the IIS, rooting at C:\inetpub\wwwroot. The web page itself is hosting a web application, based in C:\inetpub\wwwroot\RestfulWebservice (which holds the files described above).
However, if I startup the IIS and visit http://localhost:80/RestfulWebservice, all I am getting is an error 403.14, stating that I may not inspect the contents of this folder unless I allow IIS to do so. If I choose to allow this, I am simply presented with the contents of the folder, not the service itself.
If I try to access a resource of the restful web service directly (i.e. http://localhost:80/RestfulWebservice/Home, I get a direct 404.0 error, telling me that the resource does not exist)
What am I doing wrong here, it can impossibly be this hard to get a compiled library ASP.NET web service to run on the IIS, it works like a charm on IIS express.
c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i

What is contained in a published ASP.net project?

I developed a site in asp.net using C# as the language.
I have debugged it and no more errors can be found and can also view the page from a browser.
I would like to host this site and direct a client to it for demo purposes but am having a problem each time I publish my site. The publishing only does away with all my .aspx.cs files but I don't see any .exe file that I can install or send to my hosting provider.
I would like to know if this what I am experiencing is normal or there are settings I need to do in my visual studio 2013 ultimate edition for these tasks to be performed?
Kindly advise me on the way forward
ASP.NET applications (not "ASP.NET websites") are compiled into a .dll file in your bin folder, which is then deployed on to the server.
Your .aspx/.cshtml1 files reference compiled classes and types contained within this DLL, thus eliminating the need for source files.
There won't be any .exe files, you need to deploy your project to a web server, like IIS. Check out this link.

ASP.NET site throws compilation error on webserver

I am working on a webserver that has ASP.NET 2.0 as the activate instance of ASP.NET (I can't change it. I don't have control over it.)
I orginally wrote the site in 4.0, not even thinking to ask what version the webserver was in. When it came to installing, I realized the error and changed the targeted framework. After a little bit of wrestling with VS 2010, it compiled fine.
I put it up, and now it is giving me this error:
Account used to be a .cs file, which I then put into it's own project so I could get in a DLL in hopes of it working with it being a dll. It always fails when it comes to the first thing that references Account.
Account is compiled against .NET 2.0.
Any help? D:
Edit: The other important thing that may change this, is that the person is already hosting another ASP.NET site on the main folder. He wants to host this site in a subfolder.
I have read that ASP.NET may not like that, so could that be the issue?
Check following:
Your application referencing assembly with Account class;
Corresponding assembly existing in web application 'bin' directory - you may referenced it, but not specified as 'copy always' in reference properties.
You built it, not just put into 'App_Code' (it is bad practice to put code in the App_Code for asp web application as I know)
Also, your error appeared only on 'production' host or reproduced also on VS devserver?

Categories

Resources