How to run application on server? - c#

I've recently received some ASP.NET application to test. I must run it on local server. I installed IIS with all components. I copied whole project to c:\inetpub\wwwroot. Catalog structure:
I suppose main file to run is Global.asax, but when i try to run localhost/.../global.asax I get error:
HTTP Error 404.3 - Not Found
Description: The page you are requesting cannot be served because of the Multipurpose
Internet Mail Extensions (MIME) map policy that is configured on the Web server. The page you requested has a file name extension that is not recognized, and is not allowed.
ASP.NET is completely new technology for me. I guess there is very easy solution ;)

You need to create a virtual deirectory on IIS ad the publish your site there. You can find complete process here:
http://msdn.microsoft.com/en-us/library/1y1404zt(v=vs.90).aspx
http://www.codeproject.com/Articles/28693/Deploying-ASP-NET-Websites-on-IIS
Seems you are using MVC. so check this : http://www.asp.net/mvc/tutorials/deployment/deployment-to-a-hosting-provider/deployment-to-a-hosting-provider-deploying-to-iis-as-a-test-environment-5-of-12

You have to create Virtual Directory of your application.
Check out this Reference.
You can directory publish your web application on IIS.
Here is walkthrough reference.

Related

Copying mini website into main website giving configuration error

Recently,
I developed one mini site and had to deploy that site in one of our main project.
What I did is, I copied the whole mini project and pasted into the main project. And when I tried running the mini project, I got error as
*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.*
Also, the error was generated from my mini web.config file from the line no : 45. Where the code was
<profile defaultProvider="DefaultProfileProvider">
I don't know what was the error all about. I also tried searching on the net for the issue and I got one link from here but it also didn't helped me out.
Please suggest something which can be of any help. Also let me know know If I have to make some changes.
Try using the System.Diagnostics.Process.Start("Link of your website.com");
or please try iframe.
The error is very specific as to what the problem is. You need to configure the virtual directory your "mini site" is in as an application in IIS.
Open up Internet Information Services Manager, expand the list of sites until you find your "mini site". Right click on it and choose "Convert to Application". Problem solved.
It sounds as though you need to mount the mini site as an application. What version of IIS are you using? The following steps for IIS 7 may help:
Creating a Web Application (Virtual Directory) in IIS 7
In case of link-rot, I'll summarise the points as well:
Open IIS Manager
Right-click on your master site and select "Add Application"
Fill out the resulting dialogue box. The alias is the "subfolder" the app will be mounted within, and the physical path is the directory your "mini site" resides in
Hope that helps.
Finally after researching so much, I got my answer.
What I need to do is(My mistake)
Converted the Web.Config file of the mini site as Convert to Application.
After that I got error as Excel03ConString already exist. For that, I commented out that line from the mini site.
Next, When I browsed the site I got error as: The Site needs default document as it was giving Membership page which comes by default.
SO I selected the default page and it started working smoothly.

asp.net page display only html tags in localhost?

asp.net page display only html tags When I want to show in my localhost. I have created a asp.net website project in vs 2010. And move the Published files to C:\wamp\www\CRS for localhost. But asp.net page display only html tags. see the Image.
This is a website project not web application. So I can't Build the package and Import to IIS. Pls help me.
Edit 1-
When I move All files to C:\inetpub\wwwroot\crs and access in localhost,.. It gives 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: 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.
What I miss?
You should use IIS to run ASP.net.
It seems you are using Apache. If you REALLY want to use Apache you need to install mono : run asp.net on apache
Otherwise setup a new website in IIS and point to your directory.
as #basarat give a way to solve this question.
1) Copy and paste the Published website files in C:\inetpub\wwwroot
2) In IIS right Cilck the Default website and Add Application property. It opens the Add Application window.
3) Give the name in Alias Field, then Give a Correct path of project.
4) Then you can access the asp.net page in localhost
check the content type that the page is served with it has to be "text/html" instead of what you have

How Can I Host A WCF App In IIS?

I'm following Microsoft's tutorial on the topic here but it's not working and several items are unclear to me.
http://msdn.microsoft.com/en-us/library/ms733766.aspx
In step 2 it says, "ensure that ASP.NET has access to the contents of the folder". How can i do this?
Is it correct that the .cs code not be compiled? I've never ran .cs as a script of any kind.
Here is my error:
HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.
Thanks.
Could you please ensure that your apppool in which your site is running in "Integrated" mode rather than Classic.
If the problem is not resolved after doing this, try to register your IIS with .netv4.0
For doing that
Go to Command Prompt
Go to the location C:\Windows\Microsoft.NET\Framework\v4.0.30319
Register the IIS using aspnet_regiis -i command
Open IISManager and go to handler mappings and right click on the static file and select "Revert to Parent"
You can Host a WCF App/Service in IIS as you host simple website. It seems to me that you are trying to access/browse .cs file. If so, then it is not possible as it is code file. You should browse only your service file i.e. .svc file.
You can refer http://adarshdchaurasia.wordpress.com/2013/09/26/create-restful-wcf-service-api-using-get-post-step-by-step-guide/ to create a WCF service.
Please ensure that:
You have .Net framework 4.0 installed and enabled on your machine. If
not, install or try to re-install. Sometimes re-installation fix the
unknown settings problem we accidentally create.
First try to host a simple demo web site to check if the problem is
with your WCF application or with hosting process your are
following.
In step 2 it says, "ensure that ASP.NET has access to the contents of
the folder". How can i do this?
I think it mean make sure your folder are accessible by the IIS_IUSRS
Check the publish folder properties -> Security tab -> group or user name.
Make sure the app is using application pool with correct .net framework version.
normally I will just set .net framework v4.0.30319

Sharepoint development deployment problems

I am getting the following error, when trying to deploy the visual studio generated Blank Sharepoint Project.
Error 1 Error occurred in deployment step 'Retract Solution': Cannot
connect to the SharePoint site: http://srv-sharepoint:35018/. Make
sure that this is a valid URL and the SharePoint site is running on
the local computer. If you moved this project to a new computer or if
the URL of the SharePoint site has changed since you created the
project, update the Site URL property of the project.
I set up a new application so have these 3 now: (Name, URL, Port)
SharePoint - 80 http://srv-sharepoint/ 80
SharePoint Central Administration v4 http://srv-sharepoint:32152/ 32152
SharePoint - Test http://srv-sharepoint:35018/ 35018
Its all on the server. And my project URL is http://srv-sharepoint:35018/
When I changed it to the admin port, it "ran" but just loaded up the admin panel.
What Am I doing wrong?
Add the current user to the web content database with owner role (more).
Have you setup the hostname ("srv-sharepoint") in your network's DNS or your machines hosts-file?
To setup your local development environment to use the "srv-sharepoint" host name, you need to add the host name to your development machine's hosts file.
The file is located at "C:\Windows\System32\drivers\etc\hosts" and you need to add an entry like this "127.0.0.1 srv-sharepoint". Note that this requires administrative privileges.
You may have to disable the loopback check as well, nut I honestly can't remember if that is necessary. See this link.
1.Check the web url in properties of the solution is valid.
(or)
2. Confirm the status of "Sharepoint timer service" is active/running.
(or)
3. It may due to the error occurred in previous deployment process of the same solution. So go to the central admin --> System Settings --> Manage Farm Solutions. Find out the solution, open it and retract the solution manually. Once retraction is completed, remove it. Then try again to deploy it using your IDE, visual studio, as administrator.
Your site url may be incorrect in solution, check it as below.
1) select the project, hit f4, properties of solution will open.
2) check the deployment url in project properties.
3) update the url as per the local url.
4) save, rebuild and deploy.
It should work.

Parser Error : Could not create type

I have created webservice and published it on local machine. Then I have uploaded it on server.
Now while I tried to access webservice it gives following error :
Parser Error Message: Could not create type 'webservice.myservice'
Source Error:
Line 1: <%# WebService Language="C#" CodeBehind="myservice.asmx.cs" Class="webservice.myservice" %>
I tried This link but unable to solve my problem.
What should I do?
I don't know if this is dragging something up from the dim and distant past, but I had this problem. I fixed it. So I thought I'd to share it.
When you create a web service in Visual Studio (I'm using 2010 but I'd imagine it's the same for others), it creates a file called Service1.asmx
You will be tempted to rename it to MyService.asmx (or whatever).
Then you'll look inside and see the line
public class Service1: System.Web.Services.WebService
which you'll change to
public class MyService: System.Web.Services.WebService
and then when you try running it, you get the error
Could not create type 'MyProject.MyService'
Because it still thinks the class is called Service1.
If you right click the .asmx file and select view markup, you'll see it still says:
<%# WebService Language="C#" CodeBehind="MyService.asmx.cs" Class="MyProject.Service1" %>
change it to
<%# WebService Language="C#" CodeBehind="MyService.asmx.cs" Class="MyProject.MyService" %>
save it, try it.
It worked for me.
I had the same problem and looked for it for a long time!
I tried a lot of things including the following:
Frameword version incorrect
A whole list of things that could be wrong
None of those worked for me. After some searching, testing and cursing, I finally found the problem: The application (webservice) was incorrectly hosted.
Let me explain with a little background:
I had a project containing two solutions: One solution was the website that I made (html, javascript, etc), the other solution contained a folder with the business logic, the database model and the webservices. Obviously the webservices folder contained my .asmx files and code-behind for them.
Project
Data Core
Database Model
Business Logic
Webservices
myWebservice.asmx
Website
I was hosting these in the following way:
My website was hosted as a new site with the website folder as root folder
My webservices I was hosting as an application in my website, with the webservices folder as root
More visually:
IIS 7
My Website => Pointing at the "Website" folder
Webservices Application => Pointing at the "Webservices" folder in the Data Core
This resulted in the following url "http://website/webservices/myWebservice.asmx", which gave me the "Could not create type" error.
Now, after playing around a bit I tried hosting my webservice application starting with the data core as root, instead of the webservice folder.
Visually:
IIS 7
My Website => Pointing at the "Website" folder
Webservices Application => Pointing at the "Data Core" folder.
Obviously using the same url as before would give me a "File not found" error. However, using the following url "http://website/webservices/webservices/myWebservice.asmx",I finally got my working webservices page!
A small url breakdown:
http ://website/ => My website from the "Website" folder
webservices/ => Equivalent to the "Data Core" folder
webservices/ => The "webservices" folder in the "Data Core" folder
myWebservice.asmx => The webservice file in the "webservices" folder, in the "Data Core" folder
I assume that because I was hosting my webservices directly from the "webservices" folder in the Data Core, that the server could not find the compiled DLL of the webservices (which resides in the "bin" folder), since I was hosting at a deeper level.
After changing the configuration and hosting the webservices from the "Data Core" folder, the IIS server could "see" the bin folder and host the webservices succesfully. When using the correct url that is ^_^
I hope this is clear and helps you with you problems!
Another thing that can cause the problem. Is not creating an application for the project through the IIS itself. If the code is already on the server navigate to it in IIS from the left Connections pane. If the web site directory is still a yellow folder icon (and not a globe icon) you need to right-click on it and choose Convert to Application otherwise follow these steps...
Start -> Search For IIS
Open It!!
Right Click on the Default Web Site or the web site you are planning to publish the service to it.
Add application... Enter an Alias ex. "MyWebService" ... Choose the physical path. in my case was C:\inetpub\wwwroot\MyWebService which is my default web site path.
Then when you publish through Visual Studio choose that folder. or just copy your code files to it.
I'm fairly certain this is just a summary of what Glenn said, but I ran into this issue because my application was created from the directory one level too high in the directory structure.
For example, my web service was in SiteProject_1/SiteProject_2/service.asmx
Originally SiteProject_1 was what I converted into the application within IIS. I was able to resolve the issue by removing that application within IIS and instead making SiteProject_2 into the application.
I was having this problem this morning and Google landed me here, but none of these answers worked for me. But I did figure out what was wrong - at least in my case - so I thought I'd share it in case it helps others.
I had a web service that had been working fine for months in a solution with other parts of the application that I work on. Yesterday, I needed to fix something in a release branch, so I opened Visual Studio on a copy of the solution in another directory. Visual Studio decided to be helpful and silently remap all my virtual directories in IIS to where the programs would be in the release folder (if I had bothered to build them, which I hadn't). Now when I tried to hit my web service, IIS was pointing to the release version which had the asmx but no bin folder.
Opening the Web properties tab in my development solution and clicking the Create Virtual Directory remapped it back to the development version and all was good with the world again.

Categories

Resources