I created a blank DB using SQL Server Management Studio. Ran the aspnet_regsql command to add the necessary tables into the DB. Opened a new Website in VS and added below pieces of code to web.config.
1.
<appSettings> <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" /></appSettings>
2.
<authentication mode="Forms" />
<authorization >
<deny users="?"/>
</authorization>
3.
<connectionStrings><remove name="LocalSqlServer"/><add name="LocalSqlServer" connectionString="Data Source=PC\SQLEXPRESS; Initial Catalog=SiteAdminDB; Integrated Security=True" providerName="System.Data.SqlClient"/></connectionStrings>
I ran this line in cmd: "C:\Program Files\IIS Express\iisexpress.exe" /path:c:\windows\Microsoft.NET\Framework\v4.0.30319\ASP.NETWebAdminFiles /vpath:"/asp.netwebadminfiles" /port:8089 /clr:4.0 /ntlm
And typed http://localhost:8089/asp.netwebadminfiles/default.aspx?applicationPhysicalPath=C:\Forms authentication\&applicationUrl=/ in address bar
But I am getting a localhost refused to connect error.
What could be the problem?
Thanks in advance!
Related
I built a REST API following this tutorial and this one, and when I run application from Visual Studio 2012 things seem to work properly.
The problem is when I publish (to file system), I get a new folder under wwwroot and some files are placed there, but when I try to access http://localhost:82/my_published_api/ I only see a list of what seems useless files, http://localhost:82/my_published_api/api/ throws a 404 as does http://localhost:82/my_published_api/api/contact/ which is actually working from VStudio.
Am I missing something? What do I need to publish to a directory and access api modules?
EDIT some extra info:
This is system.web section in Web.Config:
<system.web>
<httpRuntime/>
<compilation debug="true" targetFramework="4.0"/>
<pages controlRenderingCompatibilityVersion="4.0">
<namespaces>
<add namespace="System.Web.Helpers"/>
<add namespace="System.Web.Mvc"/>
<add namespace="System.Web.Mvc.Ajax"/>
<add namespace="System.Web.Mvc.Html"/>
<add namespace="System.Web.Routing"/>
<add namespace="System.Web.WebPages"/>
</namespaces>
</pages>
</system.web>
And pre-production published version is running in http://localhost:82/my_published_api/ (this is the one which throws 404) while Visual Studio runtime server runs in http://localhost:51976/api/contact/ (this one runs properly)
Pre-production site is IIS under Windows 7, real production site will be a Windows server 2003.
Thank you
I downloaded a asp.net webform application off the internet and it included a .sql file to create the database and tables. I'm new to asp.net/visual studio and kind of stuck with this for days now. Need help.
here's the content of the web.config
<configuration>
<connectionStrings>
<add name="MyConsString" connectionString="Data Source=localhost\SQLEXPRESS; Initial Catalog=myslideshow; Integrated Security=SSPI;" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<httpRuntime executionTimeout="240" maxRequestLength="10240000" />
</system.web>
Open the file with .sql extension in visual studio
Right Click
Execute script
Open the SQL file
use CTRL-SHIFT-E
I have configured IIS 6.0 on Windows Server 2003, run ASP and HTML well, I have configured a FTP site to update the asp.net via Visual Studio 2010, VStudio makes the publication fine creating these files in the website folder:
Web.config
Site.Master
Site1.Master
Global.asax
Default.aspx
About.aspx
Styles
Scripts
bin
Account
When I try to run default.aspx I have this error:
Message Error of Analyser: Section not recognized : 'connectionStrings'
Line 9:
Line 10: <configuration>
Line 11: <connectionStrings>
Line 12: <add name="ApplicationServices"
Line 13: connectionString="data source= 192.168.1.2; ;Initial Catalog =ifdcontroladoria3;uid =sa;pwd = admin2012"
this is the code of webconfig
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="ApplicationServices"
connectionString="Data Source=192.168.1.2 ;Initial Catalog =ifdcontrol;uid =sa;pwd = evita"
providerName="System.Data.SqlClient" />
</connectionStrings>
The server 192.168.1.2 or MAQ001 is on the same computer of the IIS 6.0, what I'm doing wrong?
<connectionStrings>
<add name="ConnectionString" providerName="MySql.Data.MySqlClient"
connectionString="Data Source=127.0.0.1; port=3306; Initial Catalog=*DbName*;
uid=root; pwd=*password*;"/>
</connectionStrings>
Make sure that you have set ASP.NET version to 2.0 or higher for your application pool. Looks like you are having this problem - http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/f3df53fe-666b-4a98-92d2-d6e4ba52552a/.
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="rde_410978ConnectionString" connectionString="Data Source=SQL2008.net.dcs.hull.ac.uk;Initial Catalog=rde_410978;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
</configuration>
Here is my config file. I'm publishing it to the server by going to build > publish website.
None of the errors are due to the server as the university has set it up and it's working correctly for other people.
the error:
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: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.
Source Error:
Line 16:
Line 17: <system.web>
Line 18: <compilation debug="false" strict="false" explicit="true" targetFramework="4.0" />
Line 19:
Line 20: <authentication mode="Forms">
Source File: C:\RDEUsers\NET\410978\web.config Line: 18
Did you check IIS?
Sometimes IIS is set to a different framework.
http://technet.microsoft.com/en-us/library/cc754523(v=ws.10).aspx
Here is a similar problem and solution:
http://forums.asp.net/t/1491204.aspx/1
I think its because of the .net version of the Deployment Environment, which I presume is not 4.0.
Check it up with others if they have the same target Framework listed i.e. 4.0.
Can someone point me to what am I doing wrong here?
I'm trying to set up an ASP.NET web app project to compile with two versions of web.config file for Release and Debug builds. So for simplicity sake, here's my web.config:
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="WhyMicrosoftSucksSoMuch" connectionString="" providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
And then I do the following in web.debug.config:
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="WhyMicrosoftSucksSoMuch"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename='C:\FilePath\Database1.mdf';User Instance=true"
providerName="System.Data.SqlClient"
xdt:Transform="SetAttributes" xdt:Locator="Match(connectionString)" />
</connectionStrings>
</configuration>
If I publish it under Debug configuration the resulting web.config looks good, but when I try to run my project from VS2010 also under Debug configuration I get an error when my logic attempts to access database:
The ConnectionString property has not been initialized.
So what's the trick here?
PS. And please don't point me to this document. I tried reading it several times but I get a headache from so much superfluous information. I guess MS doesn't know what brief is.
When running it under debug mode it doesn't apply any transformations.
It only applies them during publishing. You can put your debug connection string in the main web.config, and add your production connection string to the web.release.config
also, you probably will want to use
xdt:Transform="Replace"