How to include classes in a deployment package of MVC? - asp.net

I have prepared a web deployment package from my staging environment as a FileSystem. However, there is not a folder with necessary classes. My logic of hitcounter is situated there. I have tried to just copy this folder with classes to a web deployment folder, but I've caught an error when I try to run my website at a hosting provider. If I run locally my web application it works okay.
Is there a special way to include this folder to a web deployment package?
I run on a restricted shared hosting (godaddy).

if your hitcounter class is inside your project namespace it will be compiled inside your project dll. so if your namespace is like myproject.helpers.hitcounter, then it will be in the myproject.dll
there is no need to add the classes to your hosting service.

Related

Application Insights added ConnectedService.json file to my project, Do I have to deploy it to the production server?

Follow up to this question:
Application Insights added ConnectedService.json file to my project, what does this do?
When I create a deployment package, via "Publish..." option, the package also include the following folder and files:
Service References\Application Insights\ConnectedService.json
I do not want to deploy something that is not required at runtime. Do I have to include the folder and file in my production server deployment?
No. Those files are only used by visual studio for its information, to know what services have been added and give you links back to them inside VS. None of that needs to be deployed. those files can all be set to do not copy/etc.

Create directory in web deploy package?

I have an ASP.NET WebForms application which I would like to publish to a Web Deploy package and deploy using the deploy.cmd script generated as part of the Web Deploy package. This basically works fine but I have one problem.
My application generates image files which are stored in a temporary directory as part of the web site (basically a subdirectory of the IIS site's physical location called temp). However, whenever I deploy my site using the deploy.cmd script, this directoty is deleted. Instead, I would like the deploy script to make sure the directory is present and that the IIS user has access to it. Is this possible to do with Web Deploy out of the box?

Deploying More Jar files (Own) in server

I am new to deployment and development of web applications.
Suppose I create three jar files and deploy them on a Tomcat server. I use maven to install the jar file and to deploy.
How is it possible to call a method in another jar file?
For example:
I developed a simple application in mytwitter.jar.
Then, I create myapp.jar, where one of the classes needs to call a method in mytwitter.jar.
Do I first deploy mytwitter.jar to the server and myapp.jar later?
You package all of the JARs you need (yours and 3rd party alike) into a WAR file which is what gets deployed to the Tomcat server. So in your maven config you likely already have dependencies configured for things like the twitter API and other packages. Just add your own JARs in there as well and then your code has access to it like anything else.

Production application referencing development directories

I am building a web application with .NET 3.5. I have several class library projects being referenced by my web forms.
I am deploying using a web setup installer.
When I install the application and hit the opening page, I get null pointer exceptions to some (not all) of the objects in my class library. Looking at the stack trace reveals that something somewhere is looking for a directory that exists only on my development machine.
When I do IISRESET, the errors vanish.
Does anyone have any idea why my application (web.config is compiled with debug="false") is attempting to look for things on my local dev machine?
My active build is set to release.
Thanks.
Did all the .dll's you used in your site get published with your code? If not make sure they are placed in by the installer, and the web config is not hard coded to look for references.
Open Visual Studio, look at the References folder and check to see if any of those references are pointing to the file(s) in your DEV machine. If so, I suggest you add a new folder to your app (i.e. Assemblies) and add all the dlls your application references in that folder.
After that, make sure all the references in your project are pointing to the dlls in the Assemblies folder and not some folder that only exists in your DEV machine.

Problems consuming webservice on ASP.NET on production(IIS) server

We've implemented some SOAP client code on our ASP.NET site that calls up a remote service. Implementation was basically done by using Visual Studio "Add Web Reference" wizard, adding proper 'using remote.service.namespace' to the code and calling the service.
Code works perfect locally(from Visual Studio), but fails on production web server with missing assembly reference error:
CS0246: The type or namespace name 'remote.service' could not be found (are you missing a using directive or an assembly reference?)
I have a sneaky suspicion that I am not deploying everything properly, maybe some one can point out what is that I am missing there?
Thanks!
Additional info:
Project is a Website.
ASP.NET version 2.0 installed and used as a target on both dev box and production server.
Proxy file generated by WSDL.exe is deployed into the root folder of the website, same folder where the page resides. Global namespace(default) was used for proxy class generation.
If this is a WebSite project, then the proxy file should reside inside the App_Code folder
You mentioned the proxy dll is placed on "the root folder of the web site, where the page resides".
You should place the dll inside the "bin" folder. If the folder is not there create it.
The Web Service client stack in .NET does runtime generation of the proxy client (from the annotations in the class generated by wsdl.exe/svcutil.exe). this generated file typically ends up in one of your servers temp directories (there's one under the main windows tree somewhere). The problem is that the ASP.NET user account doesn't have rights to write to this particular temp directory, but doesn't notice at the time it writes the file, so you end up with an error with it trying to load the generated file back. You can end up in the situation depending on the exact installation order on your server. Once you find the right directory you can simply fix the NTFS perms on the directory to solve the problem.
Did you copy the App_WebReferences folder and all its contents to the server?
Does other parts of your ASP.NET site work?
Does your site target 3.5 and possibly 3.5 is not installed on the production server?
Is this a Web Site, or a Web Application Project? I bet it's a Web Site.

Resources