|
A project gets built fine from Visual Studio without a problem from developers work station. Now we need to move it to DEV and UAT server. I've been struggling all day trying to get my ASP.NET project built with msbuild on a server with no Visual Studio installed (dev tools not permitted on servers) -
The type or namespace name 'Optimization' does not exist in the namespace 'System.Web'
The type or namespace name 'DotNetOpenAuth' could not be found
Couple attempts were made:
1. Install Windows SDK (http://msdn.microsoft.com/en-US/windows/hardware/hh852363) - appears there has been a lot of discussions from another Stackoverflow post (Couple relevant posts from Stackoverflow did not help[^]). You'd also need to add to environment variables PATH
C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools
(This did NOT help)
2: gacutil to install the dll's? (no vs command prompt - as said, no dev tool/Visual Studio permitted on server)
3: copy the dlls' to (i.e. same folder as MSBuild.exe):
C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\
(This did NOT help)
4: Copy local = true
(This did NOT help - the dll's apparent msbuild can't find already in bin folder of the ASP.NET application)
It appears to be a bug with msbuild - http://social.msdn.microsoft.com/Forums/vstudio/en-US/434abf1a-30db-4b13-8062-13755898dd71/msbuild-is-unable-to-link-to-a-webapplication-project?forum=msbuild
Anyone has experience with this? Thanks
dev
modified 20-Jun-14 18:14pm.
|
|
|
|
|
I want to store the values of a Gridview selected row in sessions through a button field in the gridview but
its giving me a "Index out of range " error at
GridViewRow row = AdminSearchGridView.Rows[index]
Note: There is only one row in the gridview currently from which I want to select the values I want.
I checked that the e.CommandArgument is returning a int value 0 but
i cannot figure out what is going wrong since AdminSearchGridView.Rows[0] makes sense as there is a row in the gridview
then why Index out of range.?
Here is my code for Gridview...
<asp:GridView ID="AdminSearchGridView" runat="server" AutoGenerateColumns="False"
Style="color: #333333; border-collapse: collapse; font-size: 14px;
text-align: center;width: 1530px; margin-left: 0px; margin-top: 0px" CellPadding="4" ForeColor="#333333"
AutoGenerateDeleteButton="True" DataKeyNames="ID" OnRowDeleting="AdminSearchGridView_RowDeleting"
OnRowCommand="AdminSearchGridView_RowCommand">
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:ButtonField ButtonType="Button" Text="Issue" CommandName="Issue" />
<asp:BoundField DataField="IssueStatus" HeaderText="Issue Status" />
<asp:BoundField DataField="AccessionNo" HeaderText="Accession Number" />
<asp:BoundField DataField="CallNo" HeaderText="Call Number" />
<asp:BoundField DataField="Title" HeaderText="Title" />
</Columns>
</asp:GridView>
Here is Code Behind...
protected void AdminSearchGridView_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Issue")
{
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = AdminSearchGridView.Rows[index];
string accessno = AdminSearchGridView.Rows[index].Cells[3].Text;
string title = AdminSearchGridView.Rows[index].Cells[5].Text;
Session["accessno"] = accessno;
Session["title"] = title;
}
}
|
|
|
|
|
The error suggests there are no rows in AdminSearchGridView at the time you call your code. Can you confirm it with debugger while running your code? The fact it is displayed on page doesn't mean it is available later
If it is the case then you can check the following:
- Make sure ViewState is enabled on your page.
- if you bind data to AdminSearchGridView in Page_Load() make sure it is no rebound on postback:
if (!IsPostBack) { }
--
"My software never has bugs. It just develops random features."
|
|
|
|
|
Hai All,
Could anyone please tell me how to configure Local SMTP server and how to send mail through C# code.
Regards,
Rajesh KAndepu
|
|
|
|
|
There are lots of samples here on CodeProject: Google will find them for you.
|
|
|
|
|
I am getting "Failure sending mail" and it said Socketexception unable to connect.
I am using windows8 and visual studio 2010. And I have ran the web application from visual studio. Should i do anything else ..
Below is my code..
<pre lang="c#">
string from = "no-reply@retro.com";
string to = "rajeshvec2006@gmail.com";
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
mail.To.Add(to);
mail.From = new System.Net.Mail.MailAddress(from, "test", System.Text.Encoding.UTF8);
mail.Subject = "test";
mail.SubjectEncoding = System.Text.Encoding.UTF8;
mail.Body = "hai";
mail.BodyEncoding = System.Text.Encoding.UTF8;
SmtpClient client = new SmtpClient();
client.Host = "Localhost";
client.Send(mail);
</pre>
Could you please help me in this..
|
|
|
|
|
SmtpClient client = new SmtpClient();
client.Host = "Localhost";
Do you have a SMTP server running on your local PC? Without it this will not work.
|
|
|
|
|
I have configured SMTP mail in IIS server 7.0. IS that enough or I have to install anything explicitly. Don't mind I am asking you minute details because this is the first time I am handling this SMTP servers.
Regards,
Rajesh
|
|
|
|
|
OK, but that does not answer my question.
|
|
|
|
|
Let me explain about my senario.....
I have a windows7 machine and IIS installed on it....I have hosted a ASP.Net website in it.. I have to send email notifications from the registered users on my website...I do not want to use gmail or any other smtp server...I have to send the mails from the site with some random mailid like noreply@something.com....How can I achieve it....
|
|
|
|
|
You still have not answered the question, "do you have an SMTP server running on 'localhost'.".
|
|
|
|
|
NO i do not have a smtp server running.. I want help about this...
|
|
|
|
|
Then you cannot send an email to that port. Google for " free SMTP" to find one.that you can use.
|
|
|
|
|
Can you suggest me any open source smtp servers..
|
|
|
|
|
|
http://www.systemnetmail.com/[^] is a good place to start.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I am getting "Failure sending mail" and it said Socketexception unable to connect.
I am using windows8 and visual studio 2010. And I have ran the web application from visual studio. Should i do anything else ..
Below is my code..
<pre lang="c#">
string from = "no-reply@retro.com";
string to = "rajeshvec2006@gmail.com";
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
mail.To.Add(to);
mail.From = new System.Net.Mail.MailAddress(from, "test", System.Text.Encoding.UTF8);
mail.Subject = "test";
mail.SubjectEncoding = System.Text.Encoding.UTF8;
mail.Body = "hai";
mail.BodyEncoding = System.Text.Encoding.UTF8;
SmtpClient client = new SmtpClient();
client.Host = "Localhost";
client.Send(mail);
</pre>
Could you please help me in this..
|
|
|
|
|
I see that the SMTP client is not configured properly. I had a very similar problem while try to send an email from my C# application.
I resolved that by configuring the SMTP client correctly. Please make sure you set all the necessary SMTP client properties, like,
- Host
- Port
- UseDefaultCredentials
- EnableSsl
- ServicePoint
Check your credentials(if you are not using the Default credentials)
|
|
|
|
|
The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
I am running this application in my local machine. So no heavy DB queries and all. I have pasted my code below. This error happens on con.Open()
string connString = ConfigurationManager.ConnectionStrings["DL"].ConnectionString;
using (SqlConnection con = new SqlConnection(connString))
{
SqlCommand cmd = new SqlCommand("spGetAllEmployees", con);
cmd.CommandType = CommandType.StoredProcedure;
con.Open();
SqlDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
Employee employee = new Employee();
employee.ID = Convert.ToInt32(rdr["ID"]);
employee.Name = rdr["name"].ToString();
employee.Gender = rdr["gender"].ToString();
employee.City = rdr["city"].ToString();
employee.DateOfBirth = Convert.ToDateTime(rdr["dateofbirth"]);
Employees.Add(employee);
}
}
Help me to resolve pls.
Thanks, Geetha
|
|
|
|
|
|
I tried setting it. but did not work.
<connectionstrings>
<add name="DL" connectionstring="Data Source=(localdb)\v11.0;Initial Catalog=Sample;Integrated Security=True;Connection Timeout=30"
="" providername="System.Data.SqlClient">
|
|
|
|
|
Did you set ConnectionTimeout and/or CommandTimeout?
If so, what values did you use?
Can you post the code of where you set these values?
Have you further details of the exception? i.e. What object has timed out?
|
|
|
|
|
The timeout error happens with connection object. Initially, i didnt have connection timeout value in the connection string. after reading prev msg, i set the connection timeout value in connection string and the value of conn string is as follows
<connectionstrings>
<add name="DL" connectionstring="Data Source=(localdb)\v11.0;Initial Catalog=Sample;Integrated Security=True;Connection Timeout=30"
="" providername="System.Data.SqlClient">
Also, I tried to see the values of
Console.WriteLine("State: {0}", con.State);
Console.WriteLine("ConnectionTimeout: {0}",
con.ConnectionTimeout);
while there was a time out error thrown on con.Open(), I hover over the state and timeout value in the above statement to see the values, the timeout was set to 30 and the state was closed.
|
|
|
|
|
System.InvalidOperationException was unhandled by user code
HResult=-2146233079
Message=Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
Source=System.Data
StackTrace:
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
|
|
|
|
|
<connectionStrings>
<add name="DL" connectionString="Data Source=(localdb)\v11.0;Initial Catalog=Sample;Integrated Security=True;Connection Timeout=30"
providerName="System.Data.SqlClient" />
</connectionStrings>
|
|
|
|