Sharepoint development deployment problems - c#

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.

Related

This site can't be reached error

I have an asp.net MVC project developed in VS2015. Now I try to run it in VS2017 and get an error:
This site can't be reached.
What can I do with this trouble?
In my case IIS Express is not allowing https so I needed to do this:
open cmd as admin
cd C:\Program Files (x86)\IIS Express
IisExpressAdminCmd.exe setupsslUrl -url:https://localhost:portnumber/ -UseSelfSigned
Here is what I did: I went to the project tab -> properties -> Web then clicked the create virtual directory and everything started working back normal.
Try this and it should work:
1-Go to your project folder and open .vs folder (keep your check hidden item-box checked as this folder may be hidden sometimes)
2- in .vs folder - open config
3- see that applicationhost config file there? Delete that thing.(Do not worry it will regenerate automatically once you recompile the project.)
link:
localhost refused to connect Error in visual studio
In my case, it was not the application but what I was submitting. My form contained a file I was uploading and when I hit submit I would get that error. Turns out the file couldn't be uploaded because the file was in use. I just closed the file I was trying to attach and it worked.
For the VS 2019, If you set SSL enabled for your project, there are two URLs create for your project (URL and SSL URL).
To fix this issue Go to project properties => Web: update the Project Url, Create virtual Directory and save.
I had the same problem, I noticed that in certificate manager => personal, the localhost certificate is missing
I copied that from certificate manager => TrustedRoot and the problem solved
altho it might be caused by other problems
Try this...
open command prompt Run as Administrator
type ipconfig /flushdns --
Message should appear: "Successfully flushed the DNS Resolver Chache".
after that type netsh winsock reset --
Message should be appear: "Successfully reset the winsock catalog. you must restart the computer in order to complete the reset."
Then restart your machine.
Here's what I did. Right-click on the project and go to properties. Under the Debug tab uncheck and check Enable SSL. It will create a random url with port. Copy and paste the generated URL in the App URL. It worked for me fine there after.
Follow the below steps
Right-click on the project and go to properties
Under the Debug tab uncheck Enable SSL
matendie answer working for me,
open cmd as admin
cd C:\Program Files (x86)\IIS Express
IisExpressAdminCmd.exe setupsslUrl -url:https://localhost:portnumber/ -UseSelfSigned

Visual studio 2013: Manually specify localhost port no. for website project

I am working on an angular project in visual studio.
I have created a Blank solution visual studio then added the existing website.
Open VS>>New Project>>Blank Solution>>Right click solution>>Add existing web site>>select Folder>>F5
Due to some reason I have to run the website on the localhost:8080 but the visual studio is setting the port itself.
How to change the running port to 8080
I have googled a lot but the only solutions I found is for ASP.net.
like
stackover flow,
microsoft docs
Alt+Enter is opening this property window
You can change the port in the Properties page of the project.
Right click the project and go to Properties or Alt + Enter.
Properties > Web.
Under Servers section, select "Specific Port" and provide one. :)
You can't change the project URL from within Visual Studio for Website projects.
There are two working methods for me, Posting this answer after testing.
First Option
Web Site Projects don't have a .*proj file to store settings instead, the settings are set in the solution file. In VS2013, the settings look something like this:
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "TestWebSite", "http://localhost:56422", "{401397AC-86F6-4661-A71B-67B4F8A3A92F}"
ProjectSection(WebsiteProperties) = preProject
UseIISExpress = "true"
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.5"
...
SlnRelativePath = "..\..\WebSites\WebSite1\"
DefaultWebSiteLanguage = "Visual Basic"
EndProjectSection
EndProject
Because the project is identified by the URL (including port), there isn't a way in the Visual studio UI to change this. You should be able to modify the solution file though, and it should work.
Note: In your case to set the port to 8080 you must open visual studio in Run as Administrator mode. You MUST run Visual Studio as an administrator in order to open websites with a port less than 1000
Credit of this option goes to Jimmy and original answer is here
Second Option
To specify a port for any web site project that uses IIS Express:
First Add the existing website and run it once. So that it gets assigned in the IIS sites list.
In project go to Solution Explorer, right-click the project name and then click Remove or Delete; don't worry, this removes the project from your solution, but does not delete the corresponding files on disk.
Navigate to the IIS Express ApplicationHost.config file. By default, this file is located in:
%systemdrive%\Users\<YourWindowsUsername>\Documents\IISExpress\config
Open the ApplicationHost.config file in a text editor. In the <sites> section, search for your site's name. In the <bindings> section of your site, you will see an element like this:
<binding protocol="http" bindingInformation="*:56422:localhost" />
Change the port number (56422 in the above example) to anything you want. e.g.:
<binding protocol="http" bindingInformation="*:8080:localhost" />
and then map mysite.dev to 127.0.0.1 in your hosts file, and then open your website from "http://mysite.dev"; but that's outside the scope of this answer so I won't go into any more details)
In Solution Explorer, right-click the solution, select Add, and then select Existing Web Site.... In the Add Existing Web Site dialog box, make sure that the Local IIS tab is selected. Under IIS Express Sites, select the site for which you have changed the port number, then click OK.
Now you can access your website from your new hostname/port.
Credit of this option goes to Saeb Amini and the original answer is here

Changing project port number in Visual Studio 2013

How can I change the project port number in Visual Studio 2013 ?
I'm using ASP.Net and I need to change the port number while debugging in Visual Studio 2013.
There are two project types in VS for ASP.NET projects:
Web Application Projects (which notably have a .csproj or .vbproj file to store these settings) have a Properties node under the project. On the Web tab, you can configure the Project URL (assuming IIS Express or IIS) to use whatever port you want, and just click the Create Virtual Directory button. These settings are saved to the project file:
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<DevelopmentServerPort>10531</DevelopmentServerPort>
...
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
Web Site Projects are different. They don't have a .*proj file to store settings in; instead, the settings are set in the solution file. In VS2013, the settings look something like this:
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "WebSite1(1)", "http://localhost:10528", "{401397AC-86F6-4661-A71B-67B4F8A3A92F}"
ProjectSection(WebsiteProperties) = preProject
UseIISExpress = "true"
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.5"
...
SlnRelativePath = "..\..\WebSites\WebSite1\"
DefaultWebSiteLanguage = "Visual Basic"
EndProjectSection
EndProject
Because the project is identified by the URL (including port), there isn't a way in the VS UI to change this. You should be able to modify the solution file though, and it should work.
Right click the web application and select "properties"
There should be a 'Web' tab where http://localhost:XXXXX is specified - change the port number there and this will modify the configuration to use your new port number.
I usually start at 10000 and increment by 1 for each web app, to attempt to steer well clear of other applications and port numbers.
This has proved to be elusive for me (WebSite Project) until I figured out the following procedure, which combines the solution provided by #Jimmy, with the added step of checking out the solution from Source Control
Steps: (if using VS2013+ with website project and SourceControl)
Check out the Solution file only (from sourceControl) (this can be tricky. the easiest way to do this is to make a small change in the Solution file properties/settings and then undo if necessary)
Locate the solution file (e.g. solution.sln) in exploer, and open in text editor.
Locate the entry: VWDPort = ...... and change to desired port: (example: "60000" - depends on your IISExpress Settings)
save the change (will prompt to reload solution)
Well, I simply could not find this (for me) mythical "Use dynamic ports" option. I have post screenshots.
On a more constructive note, I believe that the port numbers are to be found in the solution file AND CRUCIALLY cross referenced against the IIS Express config file
C:\Users\<username>\Documents\IISExpress\config\applicationhost.config
I tried editing the port number in just the solution file but strange things happened. I propose (no time yet) that it needs a consistent edit across both the solution file and the config file.
Open Solution file (.sln) in Editable mode (Notepad or notepad++ or any other tool)
Find tag name VMDPort and update it to your desired port.
see below snap.
To specify a port for the ASP.NET Development Server
In Solution Explorer, click the name of the application.
In the Properties pane, click the down-arrow beside Use dynamic ports
and select False from the dropdown list.
This will enable editing of the Port number property.
In the Properties pane, click the text box beside Port number and
type in a port number. Click outside of the Properties pane. This
saves the property settings.
Each time you run a file-system Web site within Visual Web Developer,
the ASP.NET Development Server will listen on the specified port.
Hope this helps.
The Visual Studio Development Server option applies only when you are
running (testing) the Web project in Visual Studio. Production Web
applications always run under IIS.
To specify the Web server for a Web site project
In Solution Explorer, right-click the name of the Web site project for which you want to specify a Web server, and then click Property
Pages.
In the Property Pages dialog box, click the Start Options tab.
Under Server, click Use custom server.
In the Base URL box, type the URL that Visual Studio should start when running the current project.
Note: If you specify the URL of a remote server (for example, an IIS Web application on another computer), be sure that the remote server is running at least the .NET Framework version 2.0.
To specify the Web server for a Web application project
In Solution Explorer, right-click the name of the Web application project for which you want to specify a Web server, and then click
Properties.
In the Properties window, click the Web tab.
Under Servers, click Use Visual Studio Development Server or Use Local IIS Web server or Use Custom Web server.
If you clicked Local IIS Web server or Use Custom Web Server, in the Base URL box, type the URL that Visual Studio should start when
running the current project.
Note: If you clicked Use Custom Web Server and specify the URL of a remote server (for example, an IIS Web application on another computer), be sure that the remote server is running at least the .NET Framework version 2.0.
(Source: https://msdn.microsoft.com/en-us/library/ms178108.aspx)
Steps to resolve this:
Open the solution file.
Find the Port tag against your project name.
Assign any different port as current.
Right click on your project and select Property Pages.
Click on Start Options tab and checked Start URL: option.
Assign the start URL in front of Start URL option like: localhost:8080/login.aspx
This is the only solution that worked for me after trying several of those above. Switch to your c:\users folder and search for .sln and then remove all .sln files that have your project name. Then restart your computer and rebuild the solution (F5) and it worked!

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

Request for the permission of type 'System.Web.AspNetHostingPermission"

I am facing a problem for running my website.
I have developed the website and when i hit F5 to view the results i am presented with this error
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.
How can i solve this problem.
This error usually happens if you Map your application folder on Network Drive or open Solution file from UNC Path. somthing like this:
Invalid Example: \\my-server\my-project
Try to open your solution from direct path
Valid Example: C:\Project\MyProject
You can also make change to your privilege of App Pool Identity but it's not recommanded:
Web Server (IIS) > App Pool Identity > Advance Settings > Set Identity as Network Service
the one shot solution worked for me was to set the App Pool Identity(Advance Settings) to Network Service
Try to set "Load User Profile" value of your application pool to "True".
It worked for me.
For what its worth, I found that the AjaxControlKit.dll on the deployed server was blocked. To resolve this, I copied over the dll to a new folder then copied and pasted in the bin folder. I guess .net doesn't like a dll being copied over directly to the web folder
you can run the following command to Grant FullTrust to remote share:
C:\Windows\Microsoft.NET\Framework\v2.0.50727>caspol.exe -m -ag 1 -url
"file:////\yourcomputername\yoursharename*" FullTrust -exclusive on
Hope this helps.
I tried all of the solutions posted here and a number of other places and nothing worked for me. I had my project located on a network drive which worked until I tried to use the AjaxControlToolkit 2.0 in my project. Apparently, something about permissions on the network drive would not allow the controls in the toolkit to run. I moved my project back to my local hard drive and it all started working.
I had this problem as well but have not seen this particular solution mentioned anywhere.
After checking permissions for the IIS user, the user for Impersonation, and granting Full Trust to the application, and still getting the error, I installed Procmon.exe on the server running IIS and noticed that IIS was attempting to access some Framework64 files for the offending website. I inspected the application pool advanced settings and discovered that "enable 32-bit applications" was set to false. Changing this setting to true proved to be the correct action. Life is good.
I face the same problem, then I realised that I was running the solution from a remote folder. Copy the necessary file to the local folder will solve the issue. But make sure that your folder have the full permission
While all of the other answers on this page may be the cause of anyone's problem, the most common one is due to OS security changes in Windows Server 2012 and above. Any file downloaded from the internet is flagged as suspicious by Windows and needs to be manually unblocked before using it in IIS. So if you FTP your code, email it, or transfer it through a cloud provider, it will be flagged and blocked.
The best solution is to use the web publishing facilities built in to Visual Studio or transfer through a network share if you're on a domain, each of which avoid this problem. However, if you must copy your code to another server by one of the means I described above, you should zip everything prior to transfer so you are only left with a single file to unblock. If you unzip before you unblock, then each file will be blocked and multi-selection will not give you the option to unblock.
So finally... to unblock: Right click the file and select Properties. Right there on the first page near the bottom you'll see an Unblock button along with the warning that the file was downloaded from the internet!
If the dll is compiled using this option (Do not merge. Create a separate assembly for each page and control), please make sure the dll is up to date. I faced the error due to aspx file is new one, but dll still using old one.
I found a potential solution that worked on my system and did not require changing to Network Service.
Go to Application Pool -> Advanced Settings -> Process Model -> Load User Profile: True
Source of this answer.
The best way to resolve this issue is Run the Visual Studio as "Administator". Right click on the Visual Studio icon and select "Run as Administrator".
Once you open Visual Studio with Full admin rights, you will be able access the page without any issues.
I have had this error and it seems to be a generic error. As there are several answers to this issue, I am going to add mine. Republishing the website on the remote server seems to fix it for me.

Categories

Resources